Fix a potential bug by checking that a buffer is not zero before attempting to deallocate it.

This commit is contained in:
Mike Brady
2024-12-04 16:06:22 +00:00
parent a4ca4b6266
commit e4d3c6f7e8
+4 -1
View File
@@ -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);