Fix use-after-free in network address lookups.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 2 Feb 2011 17:30:47 +0000 (09:30 -0800)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 2 Feb 2011 17:30:47 +0000 (09:30 -0800)
bluesky/store-simple.c

index fdd5139..ad93a05 100644 (file)
@@ -273,7 +273,6 @@ static gpointer simplestore_new(const gchar *path)
                 gai_strerror(res));
         return NULL;
     }
-    freeaddrinfo(lookup_result);
     for (struct addrinfo *ai = lookup_result; ai != NULL; ai = ai->ai_next) {
         printf("flags=%d family=%d socktype=%d proto=%d\n",
                ai->ai_flags,
@@ -287,6 +286,7 @@ static gpointer simplestore_new(const gchar *path)
             fprintf(stderr, "Warning: Bad address record size!\n");
         }
     }
+    freeaddrinfo(lookup_result);
 
     store->fd_pool = g_queue_new();
     store->fd_pool_lock = g_mutex_new();