evhtp mem leak, debug 1->2

This commit is contained in:
Olof hagsand 2020-09-10 18:06:44 +02:00
parent 804b329301
commit a61bdffbab
6 changed files with 24 additions and 13 deletions

View file

@ -24,7 +24,7 @@
* [3.3.1](#331) June 7 2017 * [3.3.1](#331) June 7 2017
## 4.7.0 ## 4.7.0
Expected: September 2020 Expected: 15 September 2020
### API changes on existing protocol/config features ### API changes on existing protocol/config features

View file

@ -97,14 +97,23 @@ static struct evhtp_handle{
static void static void
evhtp_terminate(struct evhtp_handle *eh) evhtp_terminate(struct evhtp_handle *eh)
{ {
evhtp_ssl_cfg_t *sc;
if (eh->eh_htp){ if (eh->eh_htp){
evhtp_unbind_socket(eh->eh_htp); evhtp_unbind_socket(eh->eh_htp);
evhtp_free(eh->eh_htp); evhtp_free(eh->eh_htp);
} }
if (eh->eh_evbase) if (eh->eh_evbase)
event_base_free(eh->eh_evbase); event_base_free(eh->eh_evbase);
if (eh->eh_ssl_config) if ((sc = eh->eh_ssl_config) != NULL){
free(eh->eh_ssl_config); if (sc->cafile)
free(sc->cafile);
if (sc->pemfile)
free(sc->pemfile);
if (sc->privfile)
free(sc->privfile);
free(sc);
}
} }
/*! Signall terminates process /*! Signall terminates process
@ -288,7 +297,7 @@ evhtp_params_set(clicon_handle h,
evhtp_uri_t *uri; evhtp_uri_t *uri;
evhtp_path_t *path; evhtp_path_t *path;
evhtp_ssl_t *ssl = NULL; evhtp_ssl_t *ssl = NULL;
char *subject; char *subject = NULL;
cvec *cvv = NULL; cvec *cvv = NULL;
char *cn; char *cn;
@ -345,6 +354,8 @@ evhtp_params_set(clicon_handle h,
goto done; goto done;
retval = 1; retval = 1;
done: done:
if (subject)
free(subject);
if (cvv) if (cvv)
cvec_free(cvv); cvec_free(cvv);
return retval; return retval;

View file

@ -731,7 +731,7 @@ xmldb_get_cache(clicon_handle h,
*xtop = x1t; *xtop = x1t;
retval = 1; retval = 1;
done: done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval); clicon_debug(2, "%s retval:%d", __FUNCTION__, retval);
if (xvec) if (xvec)
free(xvec); free(xvec);
return retval; return retval;
@ -832,7 +832,7 @@ xmldb_get_zerocopy(clicon_handle h,
*xtop = x0t; *xtop = x0t;
retval = 1; retval = 1;
done: done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval); clicon_debug(2, "%s retval:%d", __FUNCTION__, retval);
if (xvec) if (xvec)
free(xvec); free(xvec);
return retval; return retval;

View file

@ -776,7 +776,7 @@ api_path2xpath_cvv(cvec *api_path,
nsc = NULL; nsc = NULL;
} }
done: done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval); clicon_debug(2, "%s retval:%d", __FUNCTION__, retval);
if (cberr) if (cberr)
cbuf_free(cberr); cbuf_free(cberr);
if (valvec) if (valvec)
@ -1052,7 +1052,7 @@ api_path2xml_vec(char **vec,
ok: ok:
retval = 1; /* OK */ retval = 1; /* OK */
done: done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval); clicon_debug(2, "%s retval:%d", __FUNCTION__, retval);
if (cberr) if (cberr)
cbuf_free(cberr); cbuf_free(cberr);
if (prefix) if (prefix)
@ -1108,7 +1108,7 @@ api_path2xml(char *api_path,
cxobj *xroot; cxobj *xroot;
cbuf *cberr = NULL; cbuf *cberr = NULL;
clicon_debug(1, "%s api_path:%s", __FUNCTION__, api_path); clicon_debug(2, "%s api_path:%s", __FUNCTION__, api_path);
if (xtop == NULL){ if (xtop == NULL){
clicon_err(OE_XML, EINVAL, "xtop is NULL"); clicon_err(OE_XML, EINVAL, "xtop is NULL");
goto done; goto done;

View file

@ -45,7 +45,7 @@ ssh -t $h "(cd src/cligen; /tmp/cligen-mk.sh)"
# pull git changes and build clixon # pull git changes and build clixon
ssh -t $h "test -d src/clixon || (cd src;git clone https://github.com/clicon/clixon.git)" ssh -t $h "test -d src/clixon || (cd src;git clone https://github.com/clicon/clixon.git)"
ssh -t $h "(cd src/clixon;git pull)" ssh -t $h "(cd src/clixon;git pull)"
ssh -t $h "(cd src/clixon; /tmp/clixon-config.sh $evhtp)" ssh -t $h "(cd src/clixon; /tmp/clixon-config.sh $restconf)"
ssh -t $h "(cd src/clixon; /tmp/clixon-mk.sh)" ssh -t $h "(cd src/clixon; /tmp/clixon-mk.sh)"
ssh -t $h sudo ldconfig ssh -t $h sudo ldconfig
# Run clixon test suite # Run clixon test suite