Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: memory leak in bin_ztcp



On Sat, Nov 01, 2008 at 06:16:13PM +0000, Clint Adams wrote:
> CID 85.
> 
> remotename is only used in the printf which follows, so there's no need to
> duplicate the string.

Missed one.

Index: Src/Modules/tcp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.48
diff -u -r1.48 tcp.c
--- Src/Modules/tcp.c	1 Nov 2008 18:20:14 -0000	1.48
+++ Src/Modules/tcp.c	6 Nov 2008 01:17:38 -0000
@@ -565,7 +565,7 @@
 		    if (zthost)
 			localname = zthost->h_name;
 		    else
-			localname = ztrdup(inet_ntoa(sess->sock.in.sin_addr));
+			localname = inet_ntoa(sess->sock.in.sin_addr);
 		    ztpeer = gethostbyaddr((const void *)&(sess->peer.in.sin_addr), sizeof(sess->peer.in.sin_addr), AF_INET);
 		    if (ztpeer)
 			remotename = ztpeer->h_name;



Messages sorted by: Reverse Date, Date, Thread, Author