aboutsummaryrefslogtreecommitdiffstats
path: root/community/nbd/fix-segfault-freeaddrinfo.patch
blob: d628c144b364b6ddaffff015b2e025fe697c20cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/nbd-server.c b/nbd-server.c
index b0720ea140..cf3df0462a 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -1700,7 +1700,9 @@ int set_peername(int net, CLIENT *client) {
 			break;
 	}
 
-	freeaddrinfo(ai);
+	if(ai) {
+		freeaddrinfo(ai);
+	}
         msg(LOG_INFO, "connect from %s, assigned file is %s",
             peername, client->exportname);
 	client->clientname=g_strdup(peername);