From f3d1d81a65bee4330531e306de16176960bed239 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 24 Jun 2021 10:59:54 +0900 Subject: [PATCH] webrtcice: Avoid access memory after free and fix memory leak [Version] 1.16.2-16 [Issue Type] SVACE (PASSED_TO_PROC_AFTER_FREE.EX) Change-Id: I61f9148466ec842972cf44d8e87a01e8a504b363 Signed-off-by: Sangchul Lee --- ext/webrtc/gstwebrtcice.c | 18 ++++++++++++++++++ packaging/gst-plugins-bad.spec | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ext/webrtc/gstwebrtcice.c b/ext/webrtc/gstwebrtcice.c index ed4c925..473da7f 100644 --- a/ext/webrtc/gstwebrtcice.c +++ b/ext/webrtc/gstwebrtcice.c @@ -631,7 +631,11 @@ gst_webrtc_ice_add_candidate (GstWebRTCICE * ice, GstWebRTCICEStream * stream, if (!cand) { /* might be a .local candidate */ char *prefix = NULL, *address = NULL, *postfix = NULL; +#ifndef __TIZEN__ char *new_addr, *new_candidate; +#else + char *new_addr = NULL, *new_candidate = NULL; +#endif char *new_candv[4] = { NULL, }; if (!get_candidate_address (candidate, &prefix, &address, &postfix)) { @@ -663,19 +667,33 @@ gst_webrtc_ice_add_candidate (GstWebRTCICE * ice, GstWebRTCICEStream * stream, cand = nice_agent_parse_remote_candidate_sdp (ice->priv->nice_agent, item->nice_stream_id, new_candidate); +#ifndef __TIZEN__ g_free (new_candidate); +#endif if (!cand) { GST_WARNING_OBJECT (ice, "Could not parse candidate \'%s\'", new_candidate); goto fail; } +#ifdef __TIZEN__ + g_free (new_addr); + g_free (new_candidate); + g_free (prefix); + g_free (address); + g_free (postfix); +#else g_free (prefix); g_free (new_addr); g_free (postfix); +#endif if (0) { fail: +#ifdef __TIZEN__ + g_free (new_addr); + g_free (new_candidate); +#endif g_free (prefix); g_free (address); g_free (postfix); diff --git a/packaging/gst-plugins-bad.spec b/packaging/gst-plugins-bad.spec index 3b08d2a..ced3d70 100644 --- a/packaging/gst-plugins-bad.spec +++ b/packaging/gst-plugins-bad.spec @@ -4,7 +4,7 @@ Name: gst-plugins-bad Version: 1.16.2 -Release: 15 +Release: 16 Summary: GStreamer Streaming-Media Framework Plug-Ins License: LGPL-2.0+ Group: Multimedia/Framework -- 2.7.4