From patchwork Mon Dec 16 00:04:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16818 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BF49044A07A for ; Mon, 16 Dec 2019 02:04:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A711A68ACBB; Mon, 16 Dec 2019 02:04:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E020F68AAC3 for ; Mon, 16 Dec 2019 02:04:50 +0200 (EET) Received: by mail-wm1-f67.google.com with SMTP id d139so3791697wmd.0 for ; Sun, 15 Dec 2019 16:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=16Ckhh91jECUJM4mY5Fj+jgScCxZSHlLyZOmsfrtkAM=; b=aUStDPBxWaS8YbQIMpZyRoc7PRXmO1mSUX7VyACTfRfaYPUCXsku/Yo5gUA9+7tBQ0 HsZbB2eDrRWCekQxwSwRTqW0SxMa1I5jIz5tK3IQ06YIjCwc2Z71iiMR2LLVihnvGMyr bedazDg82zyh7NydQn+jPCYYcIsFWV1MM+ntRjm3hqYteZdD6MVaMVYyBGmEahS+XI+R X7jGTYKUqBrhw7A6m4EKNh8x+vtWVFowK1aqnN0+BbYRImCxzAXgfTRw//HQOeGWpWwA kQbWb1mSy8t253h3GqGNByrq+YV1FSPuW1ZTleqROqAWSfNkg9IJepT9MTgvufe9/p4k bLsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=16Ckhh91jECUJM4mY5Fj+jgScCxZSHlLyZOmsfrtkAM=; b=HmaBBOoQHGC8+sJWMBSNBfCN3zA67nKoVEU5o2mJZykrB0oYVhJ2qGclq2HvMcUs+c GoDLo1+GS2trpRaSXdXa/YNpGcCtPgA+ukEv0TtBDAFiKrfeT3GNmWlZp+C54LoTdTN5 +FbZWPDiB86OmoRtfDvF+MYb8K7fPsVBhM0TTulEF6w2BfZ4IDN7GWyj/X49+HrQUJrq /9TdPssyUDqtRCehpT8F9idg+Rs/iQgaH5Zw20DwbQ8T/OyTyPe3lHC/jfTwB8MbtO4c Yyrb7As9TAA/EV37+o1v83OeZ47OyAjutjU1wDCvlDG6yjlv+qOkM+oIfZwE48RhptpA Osww== X-Gm-Message-State: APjAAAWCaIUrW/UnRyvShwOAYyYBtCVQ5BkBf/Zbbmvjje7fIPK2UYWF NBqJgnja5Ea00yFsNMFV/4ZAK6LJ X-Google-Smtp-Source: APXvYqxFRJ7F7dddlMZBXGO6+B3Hkx++BkaOiVcUe1SS7M20wii/3WMHUkWGTqG7FQ0hTltejAQnLg== X-Received: by 2002:a05:600c:cd:: with SMTP id u13mr27135078wmm.24.1576454690192; Sun, 15 Dec 2019 16:04:50 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08e23.dynamic.kabel-deutschland.de. [188.192.142.35]) by smtp.gmail.com with ESMTPSA id s1sm19214442wmc.23.2019.12.15.16.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2019 16:04:49 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 16 Dec 2019 01:04:14 +0100 Message-Id: <20191216000418.24707-13-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191216000418.24707-1-andreas.rheinhardt@gmail.com> References: <20191216000418.24707-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/16] avformat/hlsenc: Unconditionally free some strings 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" hls_init() would at first allocate the vtt_basename string, then allocate the vtt_m3u8_name string followed by several operations that may fail and then open the subtitles' output context. Yet upon freeing, these strings were only freed when the subtitles' output context existed, ensuring that they leak if something goes wrong between their allocation and the opening of the subtitles' output context. So drop the check for whether this output context exists. Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index d5682caaf7..d738b08a3f 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2507,12 +2507,10 @@ static void hls_deinit(AVFormatContext *s) av_freep(&vs->basename); av_freep(&vs->base_output_dirname); av_freep(&vs->fmp4_init_filename); - if (vtt_oc) { - av_freep(&vs->vtt_basename); - av_freep(&vs->vtt_m3u8_name); - avformat_free_context(vtt_oc); - } + av_freep(&vs->vtt_basename); + av_freep(&vs->vtt_m3u8_name); + avformat_free_context(vtt_oc); avformat_free_context(vs->avf); hls_free_segments(vs->segments);