From patchwork Fri May 5 08:44:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 41480 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp318302pzb; Fri, 5 May 2023 01:44:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+Ofk+TDwCSmvqe08cuEN9XGbV0lewaMWCCLCofsxi39QMZ7tPoYIpWDnXzYQUd7qk114L X-Received: by 2002:a17:907:8691:b0:930:e9ee:c474 with SMTP id qa17-20020a170907869100b00930e9eec474mr569982ejc.54.1683276280877; Fri, 05 May 2023 01:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683276280; cv=none; d=google.com; s=arc-20160816; b=VaAEMCe9VqipwrSDVrTMo8P5QQcyoai98JEv0AGELbLZJFpVUD3mB3PI+TSl/owaNm JPCwi5/mwBVJHJZyfVzlPW8TFDt1Vy8XyzqodpHWs8GAxCrk75HxU7rKY9hN1zQV7Oyk Zf8zTnU51DzO6l++PXkO3GW+nDDXFz+8s05wOVC6GkAUcbSuA0LkSBxhSdV/09jlSHtS X073mwXzwacxjUKJ9qUAciOsex/BlKfmUrT73kvyJPB3OFdYACchSCn696VBkJHGcaO/ LUws1D9ZTQKAUdy3hkQ+3ioqm2XRMrx/X2CmbbBfbB861qWSL1w8rf00HhFx/7SRkAbr ob5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:date:to:from:message-id :dkim-signature:delivered-to; bh=r1IZbzsq7Uwzml5PUVMxkZGlcsHrQRKZRm+YhQ9Pzpo=; b=f0m40sy5EcMNItVdolSeL5NgHwt3gRuXwpq4gN9yafIRGErizz58dpfLofusqJBv0t TBtXdeN8lm8j9JVJ/gCLJD1aXlBqtGZiP+NWqU1bWtAaOSlfE4yfTljTtftin/4PO+s1 nTSPjwqlxeser7pK76rwC9/hS/Oz3H/QZ3KApQqsqp+EhIND0X31A3YO8v+xGNqWydEP U8OGts+4EVwAfq38KCj97x0GYFMbvHoFXIf4khy12KGKTBhIYhOfsBgHACnJ7ecIRmUw DwdZM15s0gtcBxIIDaR/80LQfWH+N2ghvfoFwuZVuZW3FMT4DSeDzjT0ri26Dujc9bn3 +QZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=AdMR31HB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a11-20020a1709065f8b00b0094f14b2d49esi899571eju.1026.2023.05.05.01.44.40; Fri, 05 May 2023 01:44:40 -0700 (PDT) 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=@foxmail.com header.s=s201512 header.b=AdMR31HB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E2E068BEB0; Fri, 5 May 2023 11:44:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5968368BEB0 for ; Fri, 5 May 2023 11:44:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1683276259; bh=WwUOe9a0NofaRF4ObCOx1hjBnvzH5T49w0I1GBKNZcQ=; h=From:To:Cc:Subject:Date; b=AdMR31HBcIss7FA/yfg5WxmITYD5bsZ53ftWwKN8o8rVb/1CzF4utpN4xLiXaF0js b9uo5MTH41rv6AvzdENK1sZq9iOuJmGTAsju0ZF/k6zh/iW3DePHCNS/b6D+T2ENWD z4GRjjsESqGcgSTCqTSYl3Bx0tqk9FqtfWUVmsm4= Received: from localhost.localdomain ([119.147.10.198]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id B12894A5; Fri, 05 May 2023 16:44:18 +0800 X-QQ-mid: xmsmtpt1683276258tjkcspvcc Message-ID: X-QQ-XMAILINFO: MesT5uKpDagVK1MC7/l0jIU3vUiDRLcXVHiuSHxUhEHy/XGgDZuKOieVmfo1ur pBysqQ5eSpS6ZErOMDAFJWQTe0rVOJt5ZeBRo8ip6qZHL+RDgwEwEXxA9BI419fmfuj/rZphOyhD qA6Uxm9m6vhExhGSROPTkf7WH8WzRPxvFGxPRVEYUxnMWIhlrvQG5uzPKV3e/bFk1FuclHRd7iaz GZ/i8K2a1wc8JJtdY113/sceu5oqhoqzf4kfqN3a0Mcr3H9Krfcb/SjAPn6l8UMF1uRIPs7BVsgz nKBi37zE6yotOCXVSL5kRwKztJqA6zBm9bwmTgVhL9HvA23mXefJAHEjGUn/P8t/F5NdOKFW14wI TMzSszNHwdVS/EICRqXSRX12Zbjp2foXSicf7zEXfhaSRJcbA91p2gVUeWhQfCVFAGMiri4RgdTu mLr25kvzz3J7sxBRWouAR/MRgyVUy7itDjwIGTr39BCKl8m/GFIMIdwjJtJQkTfBCDrlb4eI940O Zj6PB6aaHOt+pVSNotA14Kit8hSUDUGrYUeePbj3VA0T0Ef+f8DaHdSsvDg2udvwd40aDfDRhFnk CT8s5QZgwkGkPoa4PkqdTfpDFkttwD+QUXDF+fZfEOKFAqho2+KtZfZ64xcmoYEfGH12K5M5PTNW Y0QiYuv/DAuPF/w341ZwUubJhfIMyDwvTRbi0R1CpO+ZJ6d6KGUcwCzj9WmeGwfPRR33cb1k3uMK o+rW3Gr9RLsG8FwLa410ZE1ZG566jralTg3o+bMKWa43tNpMjaLfhhVNeCfEtJn8fwrms5f+EqNM hw/b/KmipQE6rDk/f/qVkXiooTNwkvxVo6yuoU7WL8hnhWvOmVwuJ7FR10DJh7/XVeaM+zpq1Z7g lzmXenM1Io2S/IfRKd7IIf+mOfm1uteZRPqsblaR2srjgoRB8TZQ6MywaOVeZcRs9pxFz9BctCWl sIIjUdn+Tbk2BbRMBw0MUlJ8tOsvry65riGL83HsU= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 May 2023 16:44:22 +0800 X-OQ-MSGID: <20230505084422.2259619-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg_opt: Fix memleak on error path X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: DFaEPk/OOvpo From: Zhao Zhili Fix ticket #10342. Signed-off-by: Zhao Zhili --- fftools/ffmpeg_opt.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index cf385c388e..002df84dcc 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -462,17 +462,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) AVStream *st; AudioChannelMap *m; char *allow_unused; - char *mapchan; av_log(NULL, AV_LOG_WARNING, "The -%s option is deprecated and will be removed. " "It can be replaced by the 'pan' filter, or in some cases by " "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt); - mapchan = av_strdup(arg); - if (!mapchan) - return AVERROR(ENOMEM); - GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps); m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1]; @@ -482,7 +477,6 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) m->file_idx = m->stream_idx = -1; if (n == 1) m->ofile_idx = m->ostream_idx = -1; - av_free(mapchan); return 0; } @@ -519,8 +513,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) exit_program(1); } /* allow trailing ? to map_channel */ - if (allow_unused = strchr(mapchan, '?')) - *allow_unused = 0; + allow_unused = strchr(arg, '?'); if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels || input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) { if (allow_unused) { @@ -534,7 +527,6 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) } } - av_free(mapchan); return 0; } #endif