From: Lars Ingebrigtsen Date: Thu, 28 Jan 2016 23:36:11 +0000 (+0100) Subject: Fix memory leak X-Git-Tag: emacs-26.0.90~2520^2~66 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=44e235dd88d3f506b31db24373c0f5d5fd27c79d;p=emacs.git Fix memory leak * process.c (connect_network_socket): Free previous sockaddr before allocating a new one. --- diff --git a/src/process.c b/src/process.c index 2f7668a555e..b5d306f7de9 100644 --- a/src/process.c +++ b/src/process.c @@ -3005,7 +3005,7 @@ void connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses) int xerrno = 0; Lisp_Object ip_address; int family; - struct sockaddr *sa; + struct sockaddr *sa = NULL; int ret; int addrlen; struct Lisp_Process *p = XPROCESS (proc); @@ -3026,6 +3026,8 @@ void connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses) #endif addrlen = get_lisp_to_sockaddr_size (ip_address, &family); + if (sa) + free (sa); sa = alloca (addrlen); conv_lisp_to_sockaddr (family, ip_address, sa, addrlen);