winbind: Use talloc in resolve_username_to_alias().
authorAndreas Schneider <asn@samba.org>
Thu, 6 Dec 2012 10:40:35 +0000 (11:40 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 12 Dec 2012 14:00:02 +0000 (15:00 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source3/winbindd/winbindd_cache.c

index ffed27b3976b90ebd8f4ae9f4fc92dc7831f5a66..76970d6be404178700b2c265028fc9d44c68f92e 100644 (file)
@@ -1111,16 +1111,18 @@ NTSTATUS resolve_username_to_alias( TALLOC_CTX *mem_ctx,
        if (!cache->tdb)
                goto do_query;
 
-       if ( (upper_name = SMB_STRDUP(name)) == NULL )
+       upper_name = talloc_strdup(mem_ctx, name);
+       if (upper_name == NULL) {
                return NT_STATUS_NO_MEMORY;
+       }
        if (!strupper_m(upper_name)) {
-               SAFE_FREE(upper_name);
+               talloc_free(upper_name);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
        centry = wcache_fetch(cache, domain, "NSS/NA/%s", upper_name);
 
-       SAFE_FREE( upper_name );
+       talloc_free(upper_name);
 
        if (!centry)
                goto do_query;