Browse Source

nhrpd: Fix crash in 'no nhrp event socket..' command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp 2 years ago
parent
commit
1a8b017715
1 changed files with 5 additions and 2 deletions
  1. 5 2
      nhrpd/nhrp_event.c

+ 5 - 2
nhrpd/nhrp_event.c

@@ -211,9 +211,12 @@ void evmgr_init(void)
 
 void evmgr_set_socket(const char *socket)
 {
-	if (nhrp_event_socket_path)
+	if (nhrp_event_socket_path) {
 		free((char *) nhrp_event_socket_path);
-	nhrp_event_socket_path = strdup(socket);
+		nhrp_event_socket_path = NULL;
+	}
+	if (socket)
+		nhrp_event_socket_path = strdup(socket);
 	evmgr_connection_error(&evmgr_connection);
 }