Skip to content

Commit e4d3c6f

Browse files
committed
Fix a potential bug by checking that a buffer is not zero before attempting to deallocate it.
1 parent a4ca4b6 commit e4d3c6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rtsp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,10 @@ enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn, rtsp_mes
14391439
*the_packet = msg;
14401440
shutdown:
14411441
if (reply != rtsp_read_request_response_ok) {
1442-
msg_free(the_packet);
1442+
if (*the_packet != NULL) {
1443+
debug(3, "Freeing the_packet");
1444+
msg_free(the_packet);
1445+
}
14431446
release_buffer = 1; // allow the buffer to be released
14441447
}
14451448
pthread_cleanup_pop(release_buffer);

0 commit comments

Comments
 (0)