diff --git a/lib/http_handlers.h b/lib/http_handlers.h index d19e73d..8615b0d 100644 --- a/lib/http_handlers.h +++ b/lib/http_handlers.h @@ -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 playlist_remove = strstr(type, "playlistRemove"); bool playlist_insert = strstr(type, "playlistInsert"); - plist_mem_free_wrapper(type); + plist_mem_free(type); if (unhandled_url_response) { goto unhandledURLResponse; } else if (playlist_remove) { @@ -460,7 +460,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_wrapper (remove_uuid); + plist_mem_free (remove_uuid); } goto finish; } 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) { #ifdef PLIST_230 - plist_mem_free_wrapper(plist_xml); + plist_mem_free(plist_xml); #else plist_to_xml_free(plist_xml); #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[fcup_response_datalen] = '\0'; memcpy(playlist, fcup_response_data, fcup_response_datalen); - plist_mem_free_wrapper(fcup_response_data); + plist_mem_free(fcup_response_data); } assert(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 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; 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"); 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; plist_get_string_val(req_uuid_node, &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"); @@ -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", 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"); @@ -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); 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) { 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; play_error:; - plist_mem_free_wrapper(playback_location); + plist_mem_free(playback_location); if (req_root_node) { plist_free(req_root_node); } diff --git a/lib/raop.c b/lib/raop.c index 604d6d3..7c1d1c9 100644 --- a/lib/raop.c +++ b/lib/raop.c @@ -33,17 +33,15 @@ #include "raop_rtp_mirror.h" #include "raop_ntp.h" -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 (plist_ptr); -#else - free (plist_ptr); -#endif + +/* libplist-2.3.0 API change */ +#ifndef PLIST_230 +static void plist_mem_free(void *ptr) { + if (ptr) { + free (ptr); } } +#endif struct raop_s { /* Callbacks for audio and video */ @@ -351,11 +349,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) { free(stripped_xml); } if (plist_xml) { -#ifdef PLIST_230 plist_mem_free(plist_xml); -#else - plist_to_xml_free(plist_xml); -#endif } plist_free(req_root_node); } else if (data_is_text) { @@ -499,11 +493,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) { free(stripped_xml); } if (plist_xml) { -#ifdef PLIST_230 plist_mem_free(plist_xml); -#else - plist_to_xml_free(plist_xml); -#endif } plist_free(res_root_node); } else if (data_is_text) { diff --git a/lib/raop_handlers.h b/lib/raop_handlers.h index 9a0143f..1cc6356 100644 --- a/lib/raop_handlers.h +++ b/lib/raop_handlers.h @@ -80,7 +80,7 @@ raop_handler_info(raop_conn_t *conn, } else if (!strcmp(qualifier_string, txtRAOP)) { add_txt_raop = true; } - plist_mem_free_wrapper(qualifier_string); + plist_mem_free(qualifier_string); } plist_free(req_root_node); } @@ -321,7 +321,7 @@ raop_handler_pairsetup_pin(raop_conn_t *conn, plist_free (req_root_node); return; } - plist_mem_free_wrapper(method); + plist_mem_free(method); method = NULL; plist_get_string_val(req_user_node, &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, (const char *) pin, &salt, &len_salt, &pk, &len_pk); - plist_mem_free_wrapper(user); + plist_mem_free(user); user = NULL; plist_free(req_root_node); if (ret < 0) { @@ -754,11 +754,11 @@ raop_handler_setup(raop_conn_t *conn, free (client_pk); } } - plist_mem_free_wrapper(deviceID); + plist_mem_free(deviceID); deviceID = NULL; - plist_mem_free_wrapper(model); + plist_mem_free(model); model = NULL; - plist_mem_free_wrapper(name); + plist_mem_free(name); name = NULL; if (admit_client == false) { /* 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," " but timingProtocol= NTP is required here", timing_protocol); } - plist_mem_free_wrapper (timing_protocol); + plist_mem_free (timing_protocol); timing_protocol = NULL; } else { 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" */ int log_level = (strstr(audiomode, "default") ? LOGGER_DEBUG : LOGGER_INFO); 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); }