diff options
author | Michael Adam <obnox@samba.org> | 2008-02-29 02:23:29 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-02-29 09:31:57 +0100 |
commit | 5827e84d88c0216c9e9e2373378b6992ce8357c5 (patch) | |
tree | 0d47a0d7e1938d60b3678efd59355156beffdc54 /source3 | |
parent | b6578dc7fedcb98186940dc82d8faccac552a361 (diff) | |
download | samba-5827e84d88c0216c9e9e2373378b6992ce8357c5.tar.gz samba-5827e84d88c0216c9e9e2373378b6992ce8357c5.tar.bz2 samba-5827e84d88c0216c9e9e2373378b6992ce8357c5.zip |
libreplace: fix rep_freeifaddrs to not segfault on NULL input.
Michael
(cherry picked from commit 0cbb87453beb52c6b0bc3a48791f49678f4030c5)
(This used to be commit 34d906ef44d1a5c3452097a9cac438d721fe35c1)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/replace/getifaddrs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/lib/replace/getifaddrs.c b/source3/lib/replace/getifaddrs.c index adc2517e5c..f6f0ec080c 100644 --- a/source3/lib/replace/getifaddrs.c +++ b/source3/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) |