httpinfo: do not close an 'error' socket return value
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 13:31:51 +0000 (15:31 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 13:33:15 +0000 (15:33 +0200)
Coverity:
CID 739658 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
At (5): "client_socket" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/httpinfo/src/olsrd_httpinfo.c

index 76671c7..79f01a1 100644 (file)
@@ -542,7 +542,9 @@ send_http_data:
 
 close_connection:
   abuf_free(&body_abuf);
-  close(client_socket);
+  if (client_socket >= 0) {
+    close(client_socket);
+  }
 }
 
 static void