r2040: fixed a memory handling error in clisocket (caught with valgrind)
authorAndrew Tridgell <tridge@samba.org>
Wed, 25 Aug 2004 02:07:53 +0000 (02:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:58:19 +0000 (12:58 -0500)
(This used to be commit f6dc62bf119c294db060b0870b6ca80bc28bd4a5)

source4/libcli/raw/clisocket.c

index 94bb447f47ea8f35c81d021f05fde3cc7d5fad55..1004db404018b54ce8e803da76cd9dfc33c31d90 100644 (file)
@@ -173,9 +173,9 @@ BOOL smbcli_sock_connect_byname(struct smbcli_socket *sock, const char *host, in
 
        if (ret) {
                sock->hostname = talloc_steal(sock, name);
+       } else {
+               talloc_free(name);
        }
 
-       talloc_destroy(name);
-
        return ret;
 }