vfs_catia: Fix bug 11827, memleak
authorVolker Lendecke <vl@samba.org>
Sun, 10 Apr 2016 10:51:15 +0000 (12:51 +0200)
committerRalph Boehme <slow@samba.org>
Mon, 11 Apr 2016 12:25:59 +0000 (14:25 +0200)
add_srt should add the mappings to the linked list even if
mappings==NULL (the default)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11827
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph B√∂hme <slow@samba.org>
Autobuild-Date(master): Mon Apr 11 14:25:59 CEST 2016 on sn-devel-144

source3/modules/vfs_catia.c

index 8622c2441c4911dc650992378a691faf06d48389..f4c77d96b1e135e8b9d8f25b16f5d7ae673e0900 100644 (file)
@@ -141,6 +141,9 @@ static struct share_mapping_entry *add_srt(int snum, const char **mappings)
 
        ret->snum = snum;
 
+       ret->next = srt_head;
+       srt_head = ret;
+
        if (mappings) {
                ret->mappings = (struct char_mappings**) ((unsigned char*) ret +
                    sizeof(struct share_mapping_entry));
@@ -176,9 +179,6 @@ static struct share_mapping_entry *add_srt(int snum, const char **mappings)
                }
        }
 
-       ret->next = srt_head;
-       srt_head = ret;
-
        return ret;
 }