From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:37:01 +0000 (+0000) Subject: Possibly fix a few memory leaks. Add a bogus exit to allow SPS to quit at the end... X-Git-Tag: 4.1-rc1~24^2~363^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=765a489db49cd9a512d53564ae22e0b2da9f9dd0;p=thirdparty%2Fshairport-sync.git Possibly fix a few memory leaks. Add a bogus exit to allow SPS to quit at the end of a play session, to make it easier to use valgrind. --- diff --git a/rtsp.c b/rtsp.c index 7f78b211..076ba702 100644 --- a/rtsp.c +++ b/rtsp.c @@ -2298,7 +2298,7 @@ void handle_command(__attribute__((unused)) rtsp_conn_info *conn, rtsp_message * uint64_t length = 0; plist_get_data_val(the_item, &buff, &length); // debug(1,"Item %d, length: %" PRId64 " bytes", item_number, length); - if ((length >= strlen("bplist00")) && (strstr(buff, "bplist00") == buff)) { + if ((buff != NULL) && (length >= strlen("bplist00")) && (strstr(buff, "bplist00") == buff)) { // debug(1,"Contains a plist."); plist_t subsidiary_plist = NULL; plist_from_memory(buff, length, &subsidiary_plist); @@ -2315,6 +2315,8 @@ void handle_command(__attribute__((unused)) rtsp_conn_info *conn, rtsp_message * debug(1, "Can't access the plist!"); } } + if (buff != NULL) + free(buff); } } } else { @@ -2521,6 +2523,8 @@ void handle_teardown_2(rtsp_conn_info *conn, __attribute__((unused)) rtsp_messag debug(1, "Connection %d: missing plist!", conn->connection_number); resp->respcode = 451; // don't know what to do here } + debug(1,"Bogus exit for valgrind."); + exit(EXIT_SUCCESS); // } #endif @@ -3080,6 +3084,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) plist_free(setupResponsePlist); msg_add_header(resp, "Content-Type", "application/x-apple-binary-plist"); } + plist_free(messagePlist); debug_log_rtsp_message(2, " SETUP response", resp); } #endif