From bcb73bb32988c44f64778c776621471a3bba2eca Mon Sep 17 00:00:00 2001 From: fredrik Date: Sun, 5 Mar 2006 19:14:57 +0000 Subject: [PATCH] Fix memory leak in net.c. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@588 959494ce-11ee-0310-bf91-de5d638817bd --- daemon/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/net.c b/daemon/net.c index a5ff113..641c5a2 100644 --- a/daemon/net.c +++ b/daemon/net.c @@ -90,7 +90,7 @@ int getpublicaddr(int af, struct sockaddr **addr, socklen_t *lenbuf) *lenbuf = sizeof(*ipv4); return(0); } - if((pif = icwcstombs(confgetstr("net", "publicif"), NULL)) == NULL) + if((pif = icswcstombs(confgetstr("net", "publicif"), NULL, NULL)) == NULL) { flog(LOG_ERR, "could not convert net.publicif into local charset: %s", strerror(errno)); return(-1); @@ -128,12 +128,14 @@ int getpublicaddr(int af, struct sockaddr **addr, socklen_t *lenbuf) memcpy(ipv4, &ifr->ifr_addr, sizeof(ifr->ifr_addr)); } else { free(ipv4); + free(conf.ifc_buf); flog(LOG_WARNING, "could not locate an unambiguous interface for determining your public IP address - set net.publicif"); errno = ENFILE; /* XXX: There's no appropriate one for this... */ return(-1); } } } + free(conf.ifc_buf); close(sock); if(ipv4 != NULL) { -- 2.11.0