From: fredrik Date: Sun, 5 Mar 2006 19:14:57 +0000 (+0000) Subject: Fix memory leak in net.c. X-Git-Tag: 0.1~45 X-Git-Url: http://git.dolda2000.com/gitweb/?p=doldaconnect.git;a=commitdiff_plain;h=bcb73bb32988c44f64778c776621471a3bba2eca 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 --- 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) {