From cb226847e5d759d76c82016c2b56b4f5ebc27af3 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 24 Aug 2009 21:02:32 +0000 Subject: [PATCH] Move a couple of allocated string variables into the same scope where they are freed to avoid a memory leak. --- nse_nsock.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nse_nsock.cc b/nse_nsock.cc index e0a16f881..78a97550f 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -771,12 +771,11 @@ void l_nsock_trace(nsock_iod nsiod, const char *message, int direction) struct sockaddr remote; - char *ipstring_local = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN); - - char *ipstring_remote = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN); - if (!nsi_is_pcap(nsiod)) { + char *ipstring_local = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN); + char *ipstring_remote = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN); + status = nsi_getlastcommunicationinfo(nsiod, &protocol, &af, &local, &remote, sizeof(sockaddr)); log_write(LOG_STDOUT, "%s: %s %s:%d %s %s:%d | %s\n",