From patchwork Thu Jan 18 10:15:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan McGrath X-Patchwork-Id: 7327 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp6700072jaa; Thu, 18 Jan 2018 02:16:11 -0800 (PST) X-Google-Smtp-Source: ACJfBovLwL5xsCqFdC6Rg0duTMZWKck/aQFKl9j8XXIkiPoyRxdLUQCb4ePBh0hoqM2INd3NRCxL X-Received: by 10.28.190.8 with SMTP id o8mr5182901wmf.52.1516270571464; Thu, 18 Jan 2018 02:16:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516270571; cv=none; d=google.com; s=arc-20160816; b=C5KCivnZuPqAn+aiq16v+vntdf4XKfwwrI8IKNKWZq17V4RHI8mjCBhsomhaNCrji9 Mv5FEGYgD37d3A1rChNZCuk9ZQKiE3Zz/AOUpsF3dnXTVS0kzAMjRqb3fwzKz4EyIoQ4 +yQtoQpi/68CaD+qkP2HDVjBY262y76AikeWjRBJQxbdiYhPZ0BqzmlQpJ0jEQU2hzlb CRYm1KW3kgheUIt4B4L+IAh2+Og+vB51AnzwLSzl0I2txamTUNHyt46QrXKq3p594DSY UGe4I/dl0NExmEs1tWG3Facp6e6NdtIHGW6q9ZYg+tK048TWtDTHOwR41Jk24KjyFf+Z KTHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=QCT+pRi+N8OvxlSEbxWINBxDnGVQG7CN5lUM1la+YI4=; b=fVA7MF6aku4JBCXE3IPe4u3pefb2h3m0Gx4O4PTUq+ypZ5Zkk6M7ity78YMb+3TqOK xNNnqz83OFEbUu0ff5eyb0SvFsAJ5aa0kyQCwbHkA7/3JPwbz+6daMHCjG0il0CoMF/G LiejuyBLdShsjsId31wQAqVcG0hUMyuFY2M9uyl7JmsKKp5deUvtw8WfLh3lD/fdv6yM JrHcHGQUqiM2T2TbDJbqp8ppxir/kLArEdXGpTQ9WnV9XsGGiAExHhmnZhD04DXx+4di 0f9270XbCfIof57esLc+n527PFIIoun3Gm554vdraTUc/Ajxig3jAkRQxN1m09i58Veq /p/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@hermana.com.au header.s=2016 header.b=3GtB+kX8; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y11si5240509wmg.95.2018.01.18.02.16.10; Thu, 18 Jan 2018 02:16:11 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@hermana.com.au header.s=2016 header.b=3GtB+kX8; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1573768A1F8; Thu, 18 Jan 2018 12:16:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.hermana.com.au (ec2-13-54-119-68.ap-southeast-2.compute.amazonaws.com [13.54.119.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4A03680D30 for ; Thu, 18 Jan 2018 12:16:00 +0200 (EET) Received: from brendan-desktop.localdomain (2001-44b8-412c-1c00-8524-484e-83b2-89c0.static.ipv6.internode.on.net [IPv6:2001:44b8:412c:1c00:8524:484e:83b2:89c0]) by mail.hermana.com.au (Postfix) with ESMTPSA id 1A91E2C6; Thu, 18 Jan 2018 10:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hermana.com.au; s=2016; t=1516270557; bh=E2UM8r9pj0DYTP7+GDEaPOuQvr5UWnvy3hRzpsksTA4=; h=From:To:Cc:Subject:Date:From; b=3GtB+kX8lfIswJYRKS8wMHNM0IJBW4ZdfgHdcUmkRDj2/1VZ7TWBkLAxUHUCjLdyZ F6NNV4dIrmi6j2IQ8pAS7vHoCIS6sFeCMVmMObS7pg17g1tvUvEJogzLYjmlPilp4G NpoeOBRTwjoc59YXU2PulV+7UpjXd1CwXAcBvWsk= From: Brendan McGrath To: ffmpeg-devel@ffmpeg.org, Steven Liu Date: Thu, 18 Jan 2018 21:15:49 +1100 Message-Id: <1516270549-6972-1-git-send-email-redmcg@redmandi.dyndns.org> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] dashdec: Only free url string if being reused X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Brendan McGrath MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If no representation bandwidth value is set, the url value returned by get_content_url is corrupt (as the memory has been freed). This change ensures the url string is not freed unless it is about to be reused Signed-off-by: Brendan McGrath --- libavformat/dashdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 2492f1d..83980b9 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -482,9 +482,11 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, return NULL; } av_strlcpy(tmp_str, url, sizeof(tmp_str)); - av_free(url); } if (rep_bandwidth_val && tmp_str[0] != '\0') { + if (url) { + av_free(url); + } url = av_strireplace(tmp_str, "$Bandwidth$", (const char*)rep_bandwidth_val); if (!url) { return NULL;