* fake-addrinfo.c (freeaddrinfo): Do not free NULL pointers
authorEzra Peisach <epeisach@mit.edu>
Tue, 30 Oct 2001 16:14:16 +0000 (16:14 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 30 Oct 2001 16:14:16 +0000 (16:14 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13905 dc483132-0cff-0310-8789-dd5450dbe970

src/include/ChangeLog
src/include/fake-addrinfo.c

index 0317417446f7df84b83f6cf385b04bf487e1bfab..b7be662418f4df10cf83881a5bc20c665fa4eec1 100644 (file)
@@ -1,3 +1,7 @@
+2001-10-30  Ezra Peisach  <epeisach@mit.edu>
+
+       * fake-addrinfo.c (freeaddrinfo): Do not free NULL pointers.
+
 2001-10-26  Ezra Peisach  <epeisach@mit.edu>
 
        * k5-int.h: Do not use "usage" in argument names in
index 333a6b16ce3899b4b63b415c0fcd7a687c220b2d..3ade9dc74f28731408fdbc8804a7b3a008076fa9 100644 (file)
@@ -263,8 +263,10 @@ void freeaddrinfo (struct addrinfo *ai)
     struct addrinfo *next;
     while (ai) {
        next = ai->ai_next;
-       free (ai->ai_canonname);
-       free (ai->ai_addr);
+       if (ai->ai_canonname)
+         free (ai->ai_canonname);
+       if (ai->ai_addr)
+         free (ai->ai_addr);
        free (ai);
        ai = next;
     }