Replace NT_STATUS_HAVE_NO_MEMORY macro
authorSwen Schillig <swen@vnet.ibm.com>
Thu, 1 Feb 2018 08:39:02 +0000 (09:39 +0100)
committerChristof Schmitt <cs@samba.org>
Fri, 2 Mar 2018 23:00:34 +0000 (00:00 +0100)
Replaced NT_STATUS_HAVE_NO_MEMORY macro and fixed
memory leaking error-path.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Sat Mar  3 00:00:34 CET 2018 on sn-devel-144

source4/libnet/libnet_lookup.c

index c4befcacda905c9e44dfa9ff0e19c387ecfd7425..63ce6015b66e76d01df806720de8cc9ca43511c9 100644 (file)
@@ -419,9 +419,15 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx
        if (domains->count > 0) {
                io->out.sid = dom_sid_add_rid(mem_ctx, domains->domains[0].sid,
                                              io->out.rid);
-               NT_STATUS_HAVE_NO_MEMORY(io->out.sid);
+               if (io->out.sid == NULL) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
                io->out.sidstr = dom_sid_string(mem_ctx, io->out.sid);
-               NT_STATUS_HAVE_NO_MEMORY(io->out.sidstr);
+               if (io->out.sidstr == NULL) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
        }
 
 success: