diff options
author | Michael Adam <obnox@samba.org> | 2008-02-29 02:23:29 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-02-29 02:23:29 +0100 |
commit | f21aac60d9937d11f3019251f1960b51b68c5e54 (patch) | |
tree | d7620d42568b022c4e140a71dde1116fcba36f2d | |
parent | daab914cafba742ff9fcb3aab55cc812cf415058 (diff) | |
download | samba-f21aac60d9937d11f3019251f1960b51b68c5e54.tar.gz samba-f21aac60d9937d11f3019251f1960b51b68c5e54.tar.bz2 samba-f21aac60d9937d11f3019251f1960b51b68c5e54.zip |
libreplace: fix rep_freeifaddrs to not segfault on NULL input.
Michael
(This used to be commit 0cbb87453beb52c6b0bc3a48791f49678f4030c5)
-rw-r--r-- | source4/lib/replace/getifaddrs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index adc2517e5c..f6f0ec080c 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -44,13 +44,14 @@ void rep_freeifaddrs(struct ifaddrs *ifp) { - free(ifp->ifa_name); - free(ifp->ifa_addr); - free(ifp->ifa_netmask); - free(ifp->ifa_dstaddr); - if (ifp->ifa_next != NULL) + if (ifp != NULL) { + free(ifp->ifa_name); + free(ifp->ifa_addr); + free(ifp->ifa_netmask); + free(ifp->ifa_dstaddr); freeifaddrs(ifp->ifa_next); - free(ifp); + free(ifp); + } } static struct sockaddr *sockaddr_dup(struct sockaddr *sa) |