LDB: Redudant test on NULL context remove
authorPetr Cech <pcech@redhat.com>
Mon, 21 Mar 2016 13:15:17 +0000 (09:15 -0400)
committerJeremy Allison <jra@samba.org>
Tue, 26 Apr 2016 06:09:25 +0000 (08:09 +0200)
There is redudant test on NULL context in ldb_dn_new_fmt() function.
We use this (NULL) context in talloc_vasprintf() function which is
able to work with NULL at all. And at the end, we free this newly
created (by talloc_vasprintf) context. So it should be safe to remove
this check.

Signed-off-by: Petr Cech <pcech@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 08:09:25 CEST 2016 on sn-devel-144

lib/ldb/common/ldb_dn.c

index b7d2de7e00fc167f36b475a56d5874f9495d1d27..ab78776368e5693538316e1b28cfdea17b766cc2 100644 (file)
@@ -171,7 +171,7 @@ struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx,
        char *strdn;
        va_list ap;
 
-       if ( (! mem_ctx) || (! ldb)) return NULL;
+       if (! ldb) return NULL;
 
        va_start(ap, new_fmt);
        strdn = talloc_vasprintf(mem_ctx, new_fmt, ap);