param: Use talloc_pooled_object
authorVolker Lendecke <vl@samba.org>
Mon, 17 Aug 2015 19:12:56 +0000 (21:12 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 21 Aug 2015 12:45:58 +0000 (14:45 +0200)
Reduce memory fragmentation a bit and obsolete NULL checks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Aug 21 14:45:58 CEST 2015 on sn-devel-104

lib/param/loadparm.c

index c62e0de..a0700a9 100644 (file)
@@ -824,20 +824,14 @@ void set_param_opt(TALLOC_CTX *mem_ctx,
                opt = opt->next;
        }
 
-       new_opt = talloc(mem_ctx, struct parmlist_entry);
+       new_opt = talloc_pooled_object(
+               mem_ctx, struct parmlist_entry,
+               2, strlen(opt_name) + 1 + strlen(opt_value) + 1);
        if (new_opt == NULL) {
                smb_panic("OOM");
        }
-
        new_opt->key = talloc_strdup(new_opt, opt_name);
-       if (new_opt->key == NULL) {
-               smb_panic("talloc_strdup failed");
-       }
-
        new_opt->value = talloc_strdup(new_opt, opt_value);
-       if (new_opt->value == NULL) {
-               smb_panic("talloc_strdup failed");
-       }
 
        new_opt->list = NULL;
        new_opt->priority = priority;