From patchwork Sun Jun 14 22:36:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20371 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 250224491DC for ; Mon, 15 Jun 2020 01:39:58 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1016F68B641; Mon, 15 Jun 2020 01:39:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DCA468B129 for ; Mon, 15 Jun 2020 01:39:56 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id l17so12813307wmj.0 for ; Sun, 14 Jun 2020 15:39:56 -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=7GDYjIBiiq5ZB5R9lCcsqddu7IQq/adf+NchiKdwfDI=; b=g/QHi5ILkkcwcnz3JkVsGzLT9OP3lshsOOoSdlmciSNalNd1ZT7ixcZvamph3dwv0t cx1o6HoZ+zbcB9FJmp5gJ+z7FI2CzjRo2khX/CQOLroI7MmZ8aE7pWwlsByOAzDDa/yL +dDR8F3q6hZjzKCBdwrd26PZDTK1R+ICJUPBD7tZulWWmiT5xuheLGynwFLwx6YerrL1 KMIFesWPSLrZ5ggUuKtz4UMvkUJ4/DUj/pHc70/DnnndPBPwxGlMpxRA7On5JgVz24r8 GHjUVR086LaSNWePnkMWqL58kJEYhBfG/e/15Kf63vTJqr2fOf3mYQbonXKfP/ps2LL+ 8X2A== 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=7GDYjIBiiq5ZB5R9lCcsqddu7IQq/adf+NchiKdwfDI=; b=LeTQEkyUFBRk5U3/iW3g1eoc6njVtKNgYt4ToF9/15s78i8I4Tol2kcobWR/FPUJ9J QZz+UU69fe/wHz8dgry5CwlkPqnL6xqNrGlkzpDMuuyIQIJ9aBj36d6hXlkNXdwzVCc7 kzkHmCqKqPPtD0ZFcC5lmlvIzruBD/A58cVO4lD7hUghJy/MrTVjVHxqnT7jv1aKmIi+ ZYQylmSZnEcA0FQ8jEObyDsws+/RiUI6j7OvxIvZiBRLfeblAZcmTg8M3Y5ZB26hILSt JNGOPsnwZM/WcGgdiBobR1PfVEeLWXZkAXjkw5lLZvFVOl1k9bNJkOpaCwcgfJOgNFOB OXMQ== X-Gm-Message-State: AOAM531pj23PV+h9yI3ueMWBeGtNpMkovtAbbmflcDlNQHkRc4rRzOBf fIJFh5S32bxcYYR35D+DXqiytKAQ X-Google-Smtp-Source: ABdhPJwvxyH6NrePpJGsMRXXv3+MWxKUEZAnaHcXWalBlqL3ZCP3BCf3HnldP/vP4MSqpLM0BYQBeA== X-Received: by 2002:a1c:b443:: with SMTP id d64mr9534578wmf.157.1592174395450; Sun, 14 Jun 2020 15:39:55 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:39:54 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:50 +0200 Message-Id: <20200614223656.21338-20-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 20/26] avformat/subviewerdec: 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/subviewerdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c index 83378eab5f..fdca3a4820 100644 --- a/libavformat/subviewerdec.c +++ b/libavformat/subviewerdec.c @@ -172,6 +172,8 @@ static int subviewer_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &subviewer->q); end: + if (res < 0) + ff_subtitles_queue_clean(&subviewer->q); av_bprint_finalize(&header, NULL); return res; }