From e4d3c6f7e850b7e1a1916bc1f1578119cb9b0a9e Mon Sep 17 00:00:00 2001 From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:06:22 +0000 Subject: [PATCH] Fix a potential bug by checking that a buffer is not zero before attempting to deallocate it. --- rtsp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtsp.c b/rtsp.c index 3c2e0b0e1..d83c7c1bf 100644 --- a/rtsp.c +++ b/rtsp.c @@ -1439,7 +1439,10 @@ enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn, rtsp_mes *the_packet = msg; shutdown: if (reply != rtsp_read_request_response_ok) { - msg_free(the_packet); + if (*the_packet != NULL) { + debug(3, "Freeing the_packet"); + msg_free(the_packet); + } release_buffer = 1; // allow the buffer to be released } pthread_cleanup_pop(release_buffer);