s4-socket: do not segfault if the socket is NULL
authorMatthieu Patou <mat@matws.net>
Wed, 26 Oct 2011 21:58:15 +0000 (23:58 +0200)
committerMatthieu Patou <mat@samba.org>
Tue, 1 Nov 2011 18:02:52 +0000 (19:02 +0100)
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Tue Nov  1 19:02:52 CET 2011 on sn-devel-104

source4/lib/socket/socket.c

index 2dbdaad11dfbd3ac29bb98703441acdd58741e28..42eb53abcef7874524436d4dc13e2f6aca13fc4d 100644 (file)
@@ -352,6 +352,9 @@ _PUBLIC_ struct tsocket_address *socket_address_to_tsocket_address(TALLOC_CTX *m
        struct tsocket_address *r;
        int ret;
 
+       if (!a) {
+               return NULL;
+       }
        if (a->sockaddr) {
                ret = tsocket_address_bsd_from_sockaddr(mem_ctx,
                                                        a->sockaddr,