do not call freeaddrinfo() on a NULL pointer.
authoreric <eric@openbsd.org>
Sat, 6 Apr 2019 10:35:48 +0000 (10:35 +0000)
committereric <eric@openbsd.org>
Sat, 6 Apr 2019 10:35:48 +0000 (10:35 +0000)
usr.sbin/lpd/resolver.c

index 5b73e29..059a103 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: resolver.c,v 1.3 2019/04/04 19:25:46 eric Exp $       */
+/*     $OpenBSD: resolver.c,v 1.4 2019/04/06 10:35:48 eric Exp $       */
 
 /*
  * Copyright (c) 2017-2018 Eric Faurot <eric@openbsd.org>
@@ -326,7 +326,8 @@ resolver_getaddrinfo_cb(struct asr_result *ar, void *arg)
        m_add_int(s->proc, ar->ar_errno);
        m_close(s->proc);
 
-       freeaddrinfo(ar->ar_addrinfo);
+       if (ar->ar_addrinfo)
+               freeaddrinfo(ar->ar_addrinfo);
        free(s);
 }