From patchwork Sun Jun 14 22:36:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20368 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 E5C234491DC for ; Mon, 15 Jun 2020 01:39:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C381168B6BC; Mon, 15 Jun 2020 01:39:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C5AD168B6B1 for ; Mon, 15 Jun 2020 01:39:20 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id l11so15184314wru.0 for ; Sun, 14 Jun 2020 15:39:20 -0700 (PDT) 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=HYveE5xltcOBDGCVS7AAgA70mWegeASOgTJ0EXgFLd8=; b=mMDHJytksOcaVDZc8qsITYhYMix/mIv5I++qRxUlbQT4WFPe0uZF51NGsyVdS0Mq87 ciimReNZJymCCWgEvY1FdwAEbEFJHxo7S7hAGsQvGXlplduD2LsHJfdnc3BLD9hp8EMl xShAb4eqGgJwud78FE7rZ9OepuCStj44w3u7Hg1ZD7EJY/Fr4CtBqnaRU2+XyHe3Bm5S UKxcMAtgzQSTQ3v8Ckf/2rDuv/JF9X4qgez4KmoqdkjbHkkN07VouMhcNLiHtR/+UG9l 8uGYORiA3PMSy2Hobs0efDD19STis2xtrxhRU7GTitaPjvdXUT8CZp0gocHaAlOdfQSZ zavQ== 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=HYveE5xltcOBDGCVS7AAgA70mWegeASOgTJ0EXgFLd8=; b=RXLeHyUj7mTjRATrY17/t2/Hnm3DSv+Gw46a4PoaSYeT4r7MfRywTleINXRyGFDJeS LGb9d7CzpbHNUhNeinWdkusiz8o8lqRn3S56dkNkWWKRCATl7gjtt96o1g3qYfJzoyN0 3zfWEUvx8/wr68glkyUlCKagy5Wq7Gf7qOXrrk0vHs/C3xli/oJ6YB17D0aLb4+N2CmL f2q+8A16S3Bfecj8nGdyINj/m/s+Tr48jSbxK/bD3pMUDuwhwLEqahVJLHKiaNNUDo3x qQGPW5Q/lHL2Ax1zejyirb1t01Nay0UcgirfjsyaEQ0XUG+OYQoj4tFY2T4DM4JWc42I 4y5Q== X-Gm-Message-State: AOAM5319+DL5VWC2HeJs47SBUHPDc3t4nmAv9Oa6+SAquBNUkPeN7rrK Yv/o0avMSGYzhYQjUtF+/Bk11rFA X-Google-Smtp-Source: ABdhPJycPUkVhGF3k1C30IbzDgRxC5C7oWL7SMZAJ5UQ3yp9VukvV/zQYc0I6vff/lY5nZb+12GiLQ== X-Received: by 2002:adf:f84d:: with SMTP id d13mr24044644wrq.99.1592174360060; Sun, 14 Jun 2020 15:39:20 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id z8sm21491034wru.33.2020.06.14.15.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:39:19 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:47 +0200 Message-Id: <20200614223656.21338-17-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> References: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 17/26] avformat/srtdec: Fix memleak upon read header failure 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" The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon reading a subsequent subtitle. Signed-off-by: Andreas Rheinhardt --- libavformat/srtdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 40d324b44d..d6ff00ba6d 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -207,6 +207,8 @@ static int srt_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &srt->q); end: + if (res < 0) + ff_subtitles_queue_clean(&srt->q); av_bprint_finalize(&buf, NULL); return res; }