1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

valgrind free rx_user_buffer if entered CONNMODE_WS_SERVING

This seems to be enough to get a clean valgrind run for the
test server with 1 x chrome and 1 x libwebsockets-test-client
session being run for 10s

lwsts[19767]: libwebsockets-test-server exited cleanly
==19767==
==19767== HEAP SUMMARY:
==19767==     in use at exit: 0 bytes in 0 blocks
==19767==   total heap usage: 41,071 allocs, 41,071 frees, 27,464,834 bytes allocated
==19767==
==19767== All heap blocks were freed -- no leaks are possible
==19767==
==19767== For counts of detected and suppressed errors, rerun with: -v
==19767== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

test client is another story...

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-02-11 12:37:13 +08:00
parent a7109e6ebf
commit bebc1bb852

View file

@ -312,7 +312,7 @@ just_kill_connection:
wsi->state = WSI_STATE_DEAD_SOCKET;
if (old_state == WSI_STATE_ESTABLISHED && wsi->u.ws.rx_user_buffer) {
if ((old_state == WSI_STATE_ESTABLISHED || wsi->mode == LWS_CONNMODE_WS_SERVING) && wsi->u.ws.rx_user_buffer) {
free(wsi->u.ws.rx_user_buffer);
wsi->u.ws.rx_user_buffer = NULL;
}