memif: fix uninitialized pointer read coverity error 41/9441/1
authorSteven <sluong@cisco.com>
Thu, 16 Nov 2017 00:00:38 +0000 (16:00 -0800)
committerSteven <sluong@cisco.com>
Thu, 16 Nov 2017 00:07:36 +0000 (16:07 -0800)
Set the content of tmp.sock prior to calling memif_msg_send_disconnect.
Also fix the problem socket was not close in the same spot due to
error encountered.

Change-Id: I8f54ebad2250d1944afcc52e71d2a59da05362af
Signed-off-by: Steven <sluong@cisco.com>
src/plugins/memif/socket.c

index 23ea249..9aa4a2e 100644 (file)
@@ -289,7 +289,9 @@ memif_msg_receive_init (memif_if_t ** mifp, memif_msg_t * msg,
   return 0;
 
 error:
+  tmp.sock = sock;
   memif_msg_send_disconnect (&tmp, err);
+  memif_socket_close (&sock);
   return err;
 }