nbd-server: zeroise hash table pointer after destroying the table
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Jun 2012 21:37:40 +0000 (01:37 +0400)
committerWouter Verhelst <w@uter.be>
Sat, 23 Jun 2012 23:38:34 +0000 (01:38 +0200)
This is required to avoid accessing freed data later in
sigterm_handler.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
nbd-server.c

index 7bf07a9b31f65a41e2bb59946b15ffd62ee89c97..2e008d87f7521de8be9381fd89396bb513ff7779 100644 (file)
@@ -2266,6 +2266,7 @@ int serveloop(GArray* servers) {
                                        }
                                        /* child */
                                        g_hash_table_destroy(children);
+                                       children = NULL;
                                        for(i=0;i<servers->len;i++) {
                                                serve=&g_array_index(servers, SERVER, i);
                                                close(serve->socket);