minor fix for plist_mem_free (libplist >= 2.3.0)

This commit is contained in:
F. Duncanh
2025-11-14 01:30:24 -05:00
parent 274c517ff2
commit f8cb14f5f1

View File

@@ -376,6 +376,19 @@ http_handler_reverse(raop_conn_t *conn, http_request_t *request, http_response_t
listed in the Master Playlist. The POST /action request contains the playlist requested by the Server in
the preceding "FCUP Request". The FCUP Request sequence continues until all Media Playlists have been obtained by the Server */
static void
plist_mem_free_wrapper(char * plist_ptr) {
/* wrapper for plist_mem_free, only available since libplist 2.3.0 */
if (plist_ptr) {
#ifdef PLIST_230
plist_mem_free (plst_ptr);
#else
free (plist_ptr);
#endif
}
}
static void
http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t *response,
char **response_data, int *response_datalen) {
@@ -435,7 +448,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
bool unhandled_url_response = strstr(type, "unhandledURLResponse");
bool playlist_remove = strstr(type, "playlistRemove");
bool playlist_insert = strstr(type, "playlistInsert");
plist_mem_free(type);
plist_mem_free_wrapper(type);
if (unhandled_url_response) {
goto unhandledURLResponse;
} else if (playlist_remove) {
@@ -461,7 +474,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
} else {
logger_log(conn->raop->logger, LOGGER_DEBUG, "removal_uuid matches playback_uuid\n");
}
plist_mem_free (remove_uuid);
plist_mem_free_wrapper (remove_uuid);
}
goto finish;
} else if (playlist_insert) {
@@ -543,14 +556,12 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
char *fcup_response_url = NULL;
plist_get_string_val(req_params_fcup_response_url_node, &fcup_response_url);
if (!fcup_response_url) {
plist_mem_free(fcup_response_url);
goto post_action_error;
}
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_URL = %s", fcup_response_url);
plist_t req_params_fcup_response_data_node = plist_dict_get_item(req_params_node, "FCUP_Response_Data");
if (!PLIST_IS_DATA(req_params_fcup_response_data_node)){
plist_mem_free(fcup_response_url);
goto post_action_error;
}
@@ -560,8 +571,6 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
fcup_response_datalen = (int) uint_val;
if (!fcup_response_data) {
free (fcup_response_url);
plist_mem_free(fcup_response_url);
goto post_action_error;
}
@@ -606,10 +615,8 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
}
}
if (fcup_response_data) {
free (fcup_response_data);
}
plist_mem_free(fcup_response_url);
plist_mem_free_wrapper(fcup_response_data);
plist_mem_free_wrapper(fcup_response_url);
int num_uri = get_num_media_uri(airplay_video);
int uri_num = get_next_media_uri_id(airplay_video);
@@ -630,6 +637,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
return;
post_action_error:;
plist_mem_free_wrapper(fcup_response_url);
http_response_init(response, "HTTP/1.1", 400, "Bad Request");
if (req_root_node) {