libsmbconf: parse an empty share as empty share, not as NULL.
authorMichael Adam <obnox@samba.org>
Mon, 27 Sep 2010 10:43:39 +0000 (12:43 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 27 Sep 2010 10:43:39 +0000 (12:43 +0200)
This fixes a segfault in net conf import:
Importing a text file with an empty share resulted in a segfault.
Now this creates an empty share in registry config, just as it
should.

Thanks to Gregor Beck <gbeck@sernet.de> for reporting.

lib/smbconf/smbconf_txt.c

index 37b01df3d302f024166a92602971ae9f7c985d79..2114841b817240cea846b65f348bfbd187c41b96 100644 (file)
@@ -453,11 +453,7 @@ static WERROR smbconf_txt_get_share(struct smbconf_ctx *ctx,
        }
 
        tmp_service->num_params = count;
-       if (count > 0) {
-               *service = talloc_move(mem_ctx, &tmp_service);
-       } else {
-               *service = NULL;
-       }
+       *service = talloc_move(mem_ctx, &tmp_service);
 
 done:
        talloc_free(tmp_ctx);