mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
cleanup plist_mem_free issues
This commit is contained in:
@@ -434,7 +434,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
bool unhandled_url_response = strstr(type, "unhandledURLResponse");
|
bool unhandled_url_response = strstr(type, "unhandledURLResponse");
|
||||||
bool playlist_remove = strstr(type, "playlistRemove");
|
bool playlist_remove = strstr(type, "playlistRemove");
|
||||||
bool playlist_insert = strstr(type, "playlistInsert");
|
bool playlist_insert = strstr(type, "playlistInsert");
|
||||||
plist_mem_free_wrapper(type);
|
plist_mem_free(type);
|
||||||
if (unhandled_url_response) {
|
if (unhandled_url_response) {
|
||||||
goto unhandledURLResponse;
|
goto unhandledURLResponse;
|
||||||
} else if (playlist_remove) {
|
} else if (playlist_remove) {
|
||||||
@@ -460,7 +460,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
} else {
|
} else {
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "removal_uuid matches playback_uuid\n");
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "removal_uuid matches playback_uuid\n");
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper (remove_uuid);
|
plist_mem_free (remove_uuid);
|
||||||
}
|
}
|
||||||
goto finish;
|
goto finish;
|
||||||
} else if (playlist_insert) {
|
} else if (playlist_insert) {
|
||||||
@@ -490,7 +490,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
}
|
}
|
||||||
if (plist_xml) {
|
if (plist_xml) {
|
||||||
#ifdef PLIST_230
|
#ifdef PLIST_230
|
||||||
plist_mem_free_wrapper(plist_xml);
|
plist_mem_free(plist_xml);
|
||||||
#else
|
#else
|
||||||
plist_to_xml_free(plist_xml);
|
plist_to_xml_free(plist_xml);
|
||||||
#endif
|
#endif
|
||||||
@@ -563,7 +563,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
playlist = (char *) malloc(fcup_response_datalen + 1);
|
playlist = (char *) malloc(fcup_response_datalen + 1);
|
||||||
playlist[fcup_response_datalen] = '\0';
|
playlist[fcup_response_datalen] = '\0';
|
||||||
memcpy(playlist, fcup_response_data, fcup_response_datalen);
|
memcpy(playlist, fcup_response_data, fcup_response_datalen);
|
||||||
plist_mem_free_wrapper(fcup_response_data);
|
plist_mem_free(fcup_response_data);
|
||||||
}
|
}
|
||||||
assert(playlist);
|
assert(playlist);
|
||||||
int playlist_len = strlen(playlist);
|
int playlist_len = strlen(playlist);
|
||||||
@@ -605,7 +605,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plist_mem_free_wrapper(fcup_response_url);
|
plist_mem_free(fcup_response_url);
|
||||||
|
|
||||||
int num_uri = get_num_media_uri(airplay_video);
|
int num_uri = get_num_media_uri(airplay_video);
|
||||||
int uri_num = get_next_media_uri_id(airplay_video);
|
int uri_num = get_next_media_uri_id(airplay_video);
|
||||||
@@ -626,7 +626,7 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
post_action_error:;
|
post_action_error:;
|
||||||
plist_mem_free_wrapper(fcup_response_url);
|
plist_mem_free(fcup_response_url);
|
||||||
http_response_init(response, "HTTP/1.1", 400, "Bad Request");
|
http_response_init(response, "HTTP/1.1", 400, "Bad Request");
|
||||||
|
|
||||||
if (req_root_node) {
|
if (req_root_node) {
|
||||||
@@ -704,7 +704,7 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
|
|||||||
char* playback_uuid = NULL;
|
char* playback_uuid = NULL;
|
||||||
plist_get_string_val(req_uuid_node, &playback_uuid);
|
plist_get_string_val(req_uuid_node, &playback_uuid);
|
||||||
set_playback_uuid(airplay_video, playback_uuid);
|
set_playback_uuid(airplay_video, playback_uuid);
|
||||||
plist_mem_free_wrapper (playback_uuid);
|
plist_mem_free (playback_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
plist_t req_content_location_node = plist_dict_get_item(req_root_node, "Content-Location");
|
plist_t req_content_location_node = plist_dict_get_item(req_root_node, "Content-Location");
|
||||||
@@ -723,7 +723,7 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
|
|||||||
logger_log(conn->raop->logger, LOGGER_WARNING, "Unsupported HLS streaming format: clientProcName %s not found in supported list: %s",
|
logger_log(conn->raop->logger, LOGGER_WARNING, "Unsupported HLS streaming format: clientProcName %s not found in supported list: %s",
|
||||||
client_proc_name, supported_hls_proc_names);
|
client_proc_name, supported_hls_proc_names);
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper(client_proc_name);
|
plist_mem_free(client_proc_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
plist_t req_start_position_seconds_node = plist_dict_get_item(req_root_node, "Start-Position-Seconds");
|
plist_t req_start_position_seconds_node = plist_dict_get_item(req_root_node, "Start-Position-Seconds");
|
||||||
@@ -747,7 +747,7 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
|
|||||||
set_next_media_uri_id(airplay_video, 0);
|
set_next_media_uri_id(airplay_video, 0);
|
||||||
fcup_request((void *) conn, playback_location, apple_session_id, get_next_FCUP_RequestID(airplay_video));
|
fcup_request((void *) conn, playback_location, apple_session_id, get_next_FCUP_RequestID(airplay_video));
|
||||||
|
|
||||||
plist_mem_free_wrapper(playback_location);
|
plist_mem_free(playback_location);
|
||||||
|
|
||||||
if (req_root_node) {
|
if (req_root_node) {
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
@@ -755,7 +755,7 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
play_error:;
|
play_error:;
|
||||||
plist_mem_free_wrapper(playback_location);
|
plist_mem_free(playback_location);
|
||||||
if (req_root_node) {
|
if (req_root_node) {
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
}
|
}
|
||||||
|
|||||||
24
lib/raop.c
24
lib/raop.c
@@ -33,17 +33,15 @@
|
|||||||
#include "raop_rtp_mirror.h"
|
#include "raop_rtp_mirror.h"
|
||||||
#include "raop_ntp.h"
|
#include "raop_ntp.h"
|
||||||
|
|
||||||
static void
|
|
||||||
plist_mem_free_wrapper(char * plist_ptr) {
|
/* libplist-2.3.0 API change */
|
||||||
/* wrapper for plist_mem_free, only available since libplist 2.3.0 */
|
#ifndef PLIST_230
|
||||||
if (plist_ptr) {
|
static void plist_mem_free(void *ptr) {
|
||||||
#ifdef PLIST_230
|
if (ptr) {
|
||||||
plist_mem_free (plist_ptr);
|
free (ptr);
|
||||||
#else
|
|
||||||
free (plist_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct raop_s {
|
struct raop_s {
|
||||||
/* Callbacks for audio and video */
|
/* Callbacks for audio and video */
|
||||||
@@ -351,11 +349,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) {
|
|||||||
free(stripped_xml);
|
free(stripped_xml);
|
||||||
}
|
}
|
||||||
if (plist_xml) {
|
if (plist_xml) {
|
||||||
#ifdef PLIST_230
|
|
||||||
plist_mem_free(plist_xml);
|
plist_mem_free(plist_xml);
|
||||||
#else
|
|
||||||
plist_to_xml_free(plist_xml);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
} else if (data_is_text) {
|
} else if (data_is_text) {
|
||||||
@@ -499,11 +493,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) {
|
|||||||
free(stripped_xml);
|
free(stripped_xml);
|
||||||
}
|
}
|
||||||
if (plist_xml) {
|
if (plist_xml) {
|
||||||
#ifdef PLIST_230
|
|
||||||
plist_mem_free(plist_xml);
|
plist_mem_free(plist_xml);
|
||||||
#else
|
|
||||||
plist_to_xml_free(plist_xml);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
plist_free(res_root_node);
|
plist_free(res_root_node);
|
||||||
} else if (data_is_text) {
|
} else if (data_is_text) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ raop_handler_info(raop_conn_t *conn,
|
|||||||
} else if (!strcmp(qualifier_string, txtRAOP)) {
|
} else if (!strcmp(qualifier_string, txtRAOP)) {
|
||||||
add_txt_raop = true;
|
add_txt_raop = true;
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper(qualifier_string);
|
plist_mem_free(qualifier_string);
|
||||||
}
|
}
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ raop_handler_pairsetup_pin(raop_conn_t *conn,
|
|||||||
plist_free (req_root_node);
|
plist_free (req_root_node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper(method);
|
plist_mem_free(method);
|
||||||
method = NULL;
|
method = NULL;
|
||||||
plist_get_string_val(req_user_node, &user);
|
plist_get_string_val(req_user_node, &user);
|
||||||
logger_log(conn->raop->logger, LOGGER_INFO, "pair-setup-pin: device_id = %s", user);
|
logger_log(conn->raop->logger, LOGGER_INFO, "pair-setup-pin: device_id = %s", user);
|
||||||
@@ -331,7 +331,7 @@ raop_handler_pairsetup_pin(raop_conn_t *conn,
|
|||||||
}
|
}
|
||||||
int ret = srp_new_user(conn->session, conn->raop->pairing, (const char *) user,
|
int ret = srp_new_user(conn->session, conn->raop->pairing, (const char *) user,
|
||||||
(const char *) pin, &salt, &len_salt, &pk, &len_pk);
|
(const char *) pin, &salt, &len_salt, &pk, &len_pk);
|
||||||
plist_mem_free_wrapper(user);
|
plist_mem_free(user);
|
||||||
user = NULL;
|
user = NULL;
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -754,11 +754,11 @@ raop_handler_setup(raop_conn_t *conn,
|
|||||||
free (client_pk);
|
free (client_pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper(deviceID);
|
plist_mem_free(deviceID);
|
||||||
deviceID = NULL;
|
deviceID = NULL;
|
||||||
plist_mem_free_wrapper(model);
|
plist_mem_free(model);
|
||||||
model = NULL;
|
model = NULL;
|
||||||
plist_mem_free_wrapper(name);
|
plist_mem_free(name);
|
||||||
name = NULL;
|
name = NULL;
|
||||||
if (admit_client == false) {
|
if (admit_client == false) {
|
||||||
/* client is not authorized to connect */
|
/* client is not authorized to connect */
|
||||||
@@ -871,7 +871,7 @@ raop_handler_setup(raop_conn_t *conn,
|
|||||||
logger_log(conn->raop->logger, LOGGER_ERR, "Client specified timingProtocol=%s,"
|
logger_log(conn->raop->logger, LOGGER_ERR, "Client specified timingProtocol=%s,"
|
||||||
" but timingProtocol= NTP is required here", timing_protocol);
|
" but timingProtocol= NTP is required here", timing_protocol);
|
||||||
}
|
}
|
||||||
plist_mem_free_wrapper (timing_protocol);
|
plist_mem_free (timing_protocol);
|
||||||
timing_protocol = NULL;
|
timing_protocol = NULL;
|
||||||
} else {
|
} else {
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "Client did not specify timingProtocol,"
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "Client did not specify timingProtocol,"
|
||||||
@@ -1170,7 +1170,7 @@ raop_handler_audiomode(raop_conn_t *conn,
|
|||||||
/* not sure what should be done with this request: usually audioMode requested is "default" */
|
/* not sure what should be done with this request: usually audioMode requested is "default" */
|
||||||
int log_level = (strstr(audiomode, "default") ? LOGGER_DEBUG : LOGGER_INFO);
|
int log_level = (strstr(audiomode, "default") ? LOGGER_DEBUG : LOGGER_INFO);
|
||||||
logger_log(conn->raop->logger, log_level, "Unhandled RTSP request \"audioMode: %s\"", audiomode);
|
logger_log(conn->raop->logger, log_level, "Unhandled RTSP request \"audioMode: %s\"", audiomode);
|
||||||
plist_mem_free_wrapper(audiomode);
|
plist_mem_free(audiomode);
|
||||||
plist_free(req_root_node);
|
plist_free(req_root_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user