namecache: fix uninitialised pointer returns
authorDavid Disseldorp <ddiss@samba.org>
Fri, 12 Sep 2014 11:11:00 +0000 (13:11 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 13 Sep 2014 01:21:39 +0000 (03:21 +0200)
asprintf_strupper_m() doesn't set *strp on error.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep 13 03:21:39 CEST 2014 on sn-devel-104

source3/libsmb/namecache.c

index 1e6158444dcfbbaa6fa488b0383badfadfe3ad69..f325c3468989ee8fce1f08fd1a571049d85e0614 100644 (file)
  *         type number
  */
 
-static charnamecache_key(const char *name,
+static char *namecache_key(const char *name,
                                int name_type)
 {
-       char *keystr;
+       char *keystr = NULL;
        asprintf_strupper_m(&keystr, NBTKEY_FMT, name, name_type);
 
        return keystr;
@@ -239,7 +239,7 @@ static char *namecache_status_record_key(const char *name,
                                const struct sockaddr_storage *keyip)
 {
        char addr[INET6_ADDRSTRLEN];
-       char *keystr;
+       char *keystr = NULL;
 
        print_sockaddr(addr, sizeof(addr), keyip);
        asprintf_strupper_m(&keystr, "NBT/%s#%02X.%02X.%s", name,