From patchwork Sun Jun 14 22:36:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20359 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 9C281449042 for ; Mon, 15 Jun 2020 01:38:44 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8B14768B61B; Mon, 15 Jun 2020 01:38:44 +0300 (EEST) 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 D4D8A68B5EF for ; Mon, 15 Jun 2020 01:38:42 +0300 (EEST) Received: by mail-wm1-f67.google.com with SMTP id r9so12804436wmh.2 for ; Sun, 14 Jun 2020 15:38:42 -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=b7ld6nP3yYFETD7dlURvVTatRbIOXIcNXpOlDi98p5s=; b=bXIUfmxMkQLwaU8lRd8ltz1GemddVYOAuPZQ8bf8W8OEoIQgPrp/GfwFwnSkPU2xcO SYi7qHl4jhIkT4I1LFMtNaJrdfk+JIGzJI6k9Lmy/WAIexaWYQmK7isDNyrkp8CArvAi vW5NjX5ySdT7kYRFyeDX68MEbqDhkR1ndaM5odGQyFY4GnOBhcZ5OWjq2j8qsGmIeZjp v0oKVTAObzL2STLmlGWK6vrGAcrLEk4QMxh5frTfcAG0xW6QbE2ciJWTbnRgNdkFnoJp mXOyeItt9KOVAx4/H6vGNbs4QuAJY0JwZopnrypHPDUrrhpKENV3llEiMPrfihygXrG9 xnLg== 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=b7ld6nP3yYFETD7dlURvVTatRbIOXIcNXpOlDi98p5s=; b=E8+7LTXUYl7Txo3xr3uIQrGq83ApUABXDkBk15arThevaBS3br3ykAcjwjjLgHGW72 UWAf8fSFZc0UsVdyepaFEtwRPjMTbnNbEjCvFpX0sccrHluh7QBd7bXXgNxDZFvneohv aaHZg2YyoWcOsbzTgoARCsFUROripiDciBNBUQEAV1o1L183NJWGXDjMz27Jvsmr4Qoi MTRrTC+AQ4Eih4Wh4bP5KWbnqjH0veGcvv52G1UpV2tAZyO7l7sRlFi3y0F1PwL1Xizh 2KSj7kX4dXpi0GghFEx/rhUE6lrwq5eSautA4b+5cXip99VHNAIjhnVA0LsdiTSuXX7e 1+9w== X-Gm-Message-State: AOAM533JVIkxvHsYpSquzy0758F5fxOy6aAzF85LpX3LtRLNu1s3hpaR HiB3s5s3HVjtQVTUbtdlECqHnjvS X-Google-Smtp-Source: ABdhPJxXvDghPH68rfskOU9o8XwNCJI+RA/CCSoQTnkgsAw9KCiIOvz1Ghq6827BvEUZmjVYlSwN+g== X-Received: by 2002:a1c:7e52:: with SMTP id z79mr10466409wmc.104.1592174321899; Sun, 14 Jun 2020 15:38:41 -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.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:38:41 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:38 +0200 Message-Id: <20200614223656.21338-8-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 08/26] avformat/assdec: 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 or if creating the extradata failed. Signed-off-by: Andreas Rheinhardt --- libavformat/assdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/assdec.c b/libavformat/assdec.c index f66b296673..8fb9e8e501 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -160,6 +160,8 @@ static int ass_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &ass->q); end: + if (res < 0) + ass_read_close(s); av_bprint_finalize(&header, NULL); av_bprint_finalize(&line, NULL); av_bprint_finalize(&rline, NULL);