evhtp debugging: memleaks, test errors, etc

This commit is contained in:
Olof hagsand 2020-11-19 18:06:20 +01:00
parent c0ad6d3f8f
commit 3d10c3bfcb
6 changed files with 21 additions and 6 deletions

View file

@ -154,7 +154,7 @@ restconf_sig_term(int arg)
// stream_child_freeall(_CLICON_HANDLE); // stream_child_freeall(_CLICON_HANDLE);
restconf_terminate(_CLICON_HANDLE); restconf_terminate(_CLICON_HANDLE);
} }
clicon_exit_set(); /* checked in clixon_event_loop() */ clicon_exit_set(); /* XXX should rather signal event_base_loop */
exit(-1); exit(-1);
} }
@ -885,6 +885,8 @@ cx_evhtp_socket_extract(clicon_handle h,
} }
retval = 0; retval = 0;
done: done:
if (cv)
cv_free(cv);
if (reason) if (reason)
free(reason); free(reason);
return retval; return retval;
@ -1230,6 +1232,15 @@ restconf_config_backend(clicon_handle h,
if (restconf_drop_privileges(h, WWWUSER) < 0) if (restconf_drop_privileges(h, WWWUSER) < 0)
goto done; goto done;
} }
/* Exit can go via signal handler without returning here */
if (xconfig){
xml_free(xconfig);
xconfig = NULL;
}
if (nsc){
cvec_free(nsc);
nsc = NULL;
}
/* libevent main loop */ /* libevent main loop */
event_base_loop(eh->eh_evbase, 0); /* XXX: replace with clixon_event_loop() */ event_base_loop(eh->eh_evbase, 0); /* XXX: replace with clixon_event_loop() */
retval = 0; retval = 0;

View file

@ -81,7 +81,7 @@ push:
# therefore the sleep 1 before tests start # therefore the sleep 1 before tests start
test: docker test: docker
./cleanup.sh ; ./start.sh # kill (ignore error) and the start it ./cleanup.sh ; ./start.sh # kill (ignore error) and the start it
sudo docker exec -t clixon-system bash -c 'sleep 1 && cd /usr/local/bin/test && ./all.sh' sudo docker exec -t clixon-system bash -c 'sleep 2 && cd /usr/local/bin/test && ./all.sh'
depend: depend:

View file

@ -214,7 +214,7 @@ distclean: clean
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
.c.o: $(GENSRC) .c.o:
rm -f $@ && $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $< rm -f $@ && $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $<
# Compute the length of the date command (and add some extra with XXX) # Compute the length of the date command (and add some extra with XXX)

View file

@ -143,15 +143,15 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg -- -s start_backend -s init -f $cfg -- -s
fi fi
new "waiting"
wait_backend
# Load restconf config for evhtp backend config # Load restconf config for evhtp backend config
if [ "${WITH_RESTCONF}" = "evhtp" ]; then if [ "${WITH_RESTCONF}" = "evhtp" ]; then
. ./restconfig.sh . ./restconfig.sh
restconfigrun restconfigrun
fi fi
new "waiting"
wait_backend
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

View file

@ -409,4 +409,7 @@ for proto in $protos; do
done done
done done
# unset conditional parameters
unset RCPROTO
rm -rf $dir rm -rf $dir

View file

@ -69,6 +69,7 @@ sudo $MAKE install
sudo ldconfig sudo ldconfig
cd test cd test
echo "#!/usr/bin/env bash" > ./site.sh echo "#!/usr/bin/env bash" > ./site.sh
echo "IPv6=true" >> ./site.sh
if [ $release = "freebsd" ]; then if [ $release = "freebsd" ]; then
echo "make=gmake" >> ./site.sh echo "make=gmake" >> ./site.sh
fi fi