On Tue, May 02, 2006 at 01:25:26AM -0700, Ted Kremenek wrote:
> Hello again,
>
> My tool flagged another potential memory leak in nsi_new2 when the
> call to dup() fails:
Verified and fixed:
Index: nsock_iod.c
===================================================================
--- nsock_iod.c (revision 2656)
+++ nsock_iod.c (working copy)
@@ -95,7 +95,10 @@
nsi->state = NSIOD_STATE_INITIAL;
} else {
nsi->sd = dup(sd);
- if (nsi->sd == -1) return NULL;
+ if (nsi->sd == -1) {
+ free(nsi);
+ return NULL;
+ }
nsock_unblock_socket(nsi->sd);
nsi->state = NSIOD_STATE_UNKNOWN;
}
(Freeing nsi is OK, even if it came from the nsp->free_iods list
rather than the safe_malloc directly).
Thanks,
Fyodor
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Received on May 02 2006