restconf memleaks
This commit is contained in:
parent
d6c175e76e
commit
c5da97e2a4
7 changed files with 23 additions and 25 deletions
|
|
@ -591,15 +591,7 @@ restconf_close_ssl_socket(restconf_conn *rc,
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int ret;
|
int ret;
|
||||||
#ifdef HAVE_LIBEVHTP
|
|
||||||
evhtp_connection_t *evconn;
|
|
||||||
|
|
||||||
if ((evconn = rc->rc_evconn) != NULL){
|
|
||||||
clicon_debug(1, "%s evconn-free (%p)", __FUNCTION__, evconn);
|
|
||||||
if (evconn)
|
|
||||||
evhtp_connection_free(evconn); /* evhtp */
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LIBEVHTP */
|
|
||||||
if (rc->rc_ssl != NULL){
|
if (rc->rc_ssl != NULL){
|
||||||
if (shutdown && (ret = SSL_shutdown(rc->rc_ssl)) < 0){
|
if (shutdown && (ret = SSL_shutdown(rc->rc_ssl)) < 0){
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -762,7 +754,6 @@ restconf_connection(int s,
|
||||||
clixon_event_unreg_fd(rc->rc_s, restconf_connection);
|
clixon_event_unreg_fd(rc->rc_s, restconf_connection);
|
||||||
clicon_debug(1, "%s evconn-free (%p) 2", __FUNCTION__, evconn);
|
clicon_debug(1, "%s evconn-free (%p) 2", __FUNCTION__, evconn);
|
||||||
restconf_conn_free(rc);
|
restconf_conn_free(rc);
|
||||||
evhtp_connection_free(evconn);
|
|
||||||
goto ok;
|
goto ok;
|
||||||
} /* connection_parse_nobev */
|
} /* connection_parse_nobev */
|
||||||
clicon_debug(1, "%s connection_parse OK", __FUNCTION__);
|
clicon_debug(1, "%s connection_parse OK", __FUNCTION__);
|
||||||
|
|
@ -998,15 +989,7 @@ ssl_alpn_check(clicon_handle h,
|
||||||
/* XXX Sending badrequest here gives a segv in SSL_shutdown() later or a SIGPIPE here */
|
/* XXX Sending badrequest here gives a segv in SSL_shutdown() later or a SIGPIPE here */
|
||||||
clicon_log(LOG_NOTICE, "Warning: ALPN: No protocol selected");
|
clicon_log(LOG_NOTICE, "Warning: ALPN: No protocol selected");
|
||||||
}
|
}
|
||||||
restconf_conn_free(rc);
|
|
||||||
#ifdef HAVE_LIBEVHTP
|
|
||||||
{
|
|
||||||
evhtp_connection_t *evconn;
|
|
||||||
|
|
||||||
if ((evconn = rc->rc_evconn) != NULL)
|
|
||||||
evhtp_connection_free(evconn); /* evhtp */
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LIBEVHTP */
|
|
||||||
if (rc->rc_ssl){
|
if (rc->rc_ssl){
|
||||||
/* nmap ssl-known-key SEGV at s->method->ssl_shutdown(s);
|
/* nmap ssl-known-key SEGV at s->method->ssl_shutdown(s);
|
||||||
* OR OpenSSL error: : SSL_shutdown, err: SSL_ERROR_SYSCALL(5)
|
* OR OpenSSL error: : SSL_shutdown, err: SSL_ERROR_SYSCALL(5)
|
||||||
|
|
@ -1024,6 +1007,7 @@ ssl_alpn_check(clicon_handle h,
|
||||||
}
|
}
|
||||||
SSL_free(rc->rc_ssl);
|
SSL_free(rc->rc_ssl);
|
||||||
}
|
}
|
||||||
|
restconf_conn_free(rc);
|
||||||
}
|
}
|
||||||
retval = 0; /* ALPN not OK */
|
retval = 0; /* ALPN not OK */
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,14 @@ restconf_conn_free(restconf_conn *rc)
|
||||||
clicon_err(OE_RESTCONF, EINVAL, "rc is NULL");
|
clicon_err(OE_RESTCONF, EINVAL, "rc is NULL");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
|
if (rc->rc_ngsession)
|
||||||
|
nghttp2_session_del(rc->rc_ngsession);
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBEVHTP
|
||||||
|
if (rc->rc_evconn)
|
||||||
|
evhtp_connection_free(rc->rc_evconn); /* evhtp */
|
||||||
|
#endif
|
||||||
/* Free all streams */
|
/* Free all streams */
|
||||||
while ((sd = rc->rc_streams) != NULL) {
|
while ((sd = rc->rc_streams) != NULL) {
|
||||||
DELQ(sd, rc->rc_streams, restconf_stream_data *);
|
DELQ(sd, rc->rc_streams, restconf_stream_data *);
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@ restconf_submit_response(nghttp2_session *session,
|
||||||
nghttp2_data_provider data_prd;
|
nghttp2_data_provider data_prd;
|
||||||
nghttp2_error ngerr;
|
nghttp2_error ngerr;
|
||||||
cg_var *cv;
|
cg_var *cv;
|
||||||
nghttp2_nv *hdrs;
|
nghttp2_nv *hdrs = NULL;
|
||||||
nghttp2_nv *hdr;
|
nghttp2_nv *hdr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char valstr[16];
|
char valstr[16];
|
||||||
|
|
@ -437,6 +437,8 @@ restconf_submit_response(nghttp2_session *session,
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||||
|
if (hdrs)
|
||||||
|
free(hdrs);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -933,7 +935,7 @@ http2_session_init(restconf_conn *rc)
|
||||||
nghttp2_session_callbacks_set_error_callback2(callbacks, error_callback2);
|
nghttp2_session_callbacks_set_error_callback2(callbacks, error_callback2);
|
||||||
|
|
||||||
/* Create session for server use, register callbacks */
|
/* Create session for server use, register callbacks */
|
||||||
if ((ngerr = nghttp2_session_server_new(&session, callbacks, rc)) < 0){
|
if ((ngerr = nghttp2_session_server_new3(&session, callbacks, rc, NULL, NULL)) < 0){
|
||||||
clicon_err(OE_NGHTTP2, ngerr, "nghttp2_session_server_new");
|
clicon_err(OE_NGHTTP2, ngerr, "nghttp2_session_server_new");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ for test in $pattern; do
|
||||||
testfile=$test
|
testfile=$test
|
||||||
. ./$test
|
. ./$test
|
||||||
errcode=$?
|
errcode=$?
|
||||||
|
endsuite
|
||||||
if [ $errcode -ne 0 ]; then
|
if [ $errcode -ne 0 ]; then
|
||||||
allerr=1
|
allerr=1
|
||||||
echo -e "\e[31mError in $test errcode=$errcode"
|
echo -e "\e[31mError in $test errcode=$errcode"
|
||||||
|
|
|
||||||
|
|
@ -432,6 +432,7 @@ function wait_restconf_stopped(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# End of test, final tests before normal exit of test
|
# End of test, final tests before normal exit of test
|
||||||
|
# Note this is a single test started by new, not a total test suite
|
||||||
function endtest()
|
function endtest()
|
||||||
{
|
{
|
||||||
if [ $valgrindtest -eq 1 ]; then
|
if [ $valgrindtest -eq 1 ]; then
|
||||||
|
|
@ -448,6 +449,12 @@ function new(){
|
||||||
>&2 echo "Test $testi($testnr) [$1]"
|
>&2 echo "Test $testi($testnr) [$1]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# End of complete test-suite, eg a test file
|
||||||
|
function endsuite()
|
||||||
|
{
|
||||||
|
unset CURLOPTS
|
||||||
|
}
|
||||||
|
|
||||||
# Evaluate and return
|
# Evaluate and return
|
||||||
# Example: expectpart $(fn arg) 0 "my return" -- "foo"
|
# Example: expectpart $(fn arg) 0 "my return" -- "foo"
|
||||||
# - evaluated expression
|
# - evaluated expression
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ function memonce(){
|
||||||
testfile=$test
|
testfile=$test
|
||||||
. ./$test
|
. ./$test
|
||||||
errcode=$?
|
errcode=$?
|
||||||
|
endsuite
|
||||||
if [ $errcode -ne 0 ]; then
|
if [ $errcode -ne 0 ]; then
|
||||||
memerr=1
|
memerr=1
|
||||||
echo -e "\e[31mError in $test errcode=$errcode"
|
echo -e "\e[31mError in $test errcode=$errcode"
|
||||||
|
|
|
||||||
|
|
@ -116,12 +116,7 @@ fi
|
||||||
new "wait backend"
|
new "wait backend"
|
||||||
wait_backend
|
wait_backend
|
||||||
|
|
||||||
#new "netconf edit config"
|
# Explicit start of restconf for easier debugging
|
||||||
#expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RESTCONFIG</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
|
||||||
|
|
||||||
#new "netconf commit"
|
|
||||||
#expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
|
||||||
|
|
||||||
if [ $RC -ne 0 ]; then
|
if [ $RC -ne 0 ]; then
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
stop_restconf_pre
|
stop_restconf_pre
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue