From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8BF174875E for ; Wed, 17 Jan 2024 09:23:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 86A2E68D015; Wed, 17 Jan 2024 11:22:51 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CDC968CD77 for ; Wed, 17 Jan 2024 11:22:40 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=bhtZWUH6; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D836B14E4 for ; Wed, 17 Jan 2024 10:22:39 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id x6d8vHdoFgmx for ; Wed, 17 Jan 2024 10:22:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1705483358; bh=4KCWgj2D9zhL9ZEzLHGH2MtGnMep2V7HvoRTNhb6mUI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bhtZWUH6novj7qK2hZ20nE2FvS1euGuOBYCpwn0zGNMCeRAIBhz4pTyQEfai0z4hi 0+cLc6D+fE0U8ewdwCcoTIR0Nqsf5YWAc41OmFGYMPGcPYS199ifMl21MO8lP2/iCI 0eGLfbHToZdfj89YNAhQvWVkr/ILeTNa/eAbPPwqWFEWsn4Z6yI/9R1FxZOdh2EsiT aLbsjrRVNX3DFfmIRp+xBtGS3mFnXYcS20ME9lnq5WaHbhQ8x9gBXwsSWv4x87WY0q eek0wHnmcFRdbSnEDdgOOgydWBVbA24TMgSo3h9lzHlNqGQcEpp2vsZXqotpEjJnj5 YTdKeGgvR7tAQ== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 1EC4F19B7 for ; Wed, 17 Jan 2024 10:22:38 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 086BE3A0582 for ; Wed, 17 Jan 2024 10:22:38 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Jan 2024 10:22:30 +0100 Message-ID: <20240117092233.8503-3-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240117092233.8503-1-anton@khirnov.net> References: <20240117092233.8503-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] fftools/ffmpeg: make attachment filenames dynamically allocated 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Do not store the supplied arg pointer directly. While that is valid for now, it will become ephemeral in the future commits. --- fftools/ffmpeg_opt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index ea995f2b5f..563f443bd8 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -124,6 +124,9 @@ static void uninit_options(OptionsContext *o) #if FFMPEG_OPT_MAP_CHANNEL av_freep(&o->audio_channel_maps); #endif + + for (i = 0; i < o->nb_attachments; i++) + av_freep(&o->attachments[i]); av_freep(&o->attachments); av_dict_free(&o->streamid); @@ -494,7 +497,10 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) if (ret < 0) return ret; - o->attachments[o->nb_attachments - 1] = arg; + o->attachments[o->nb_attachments - 1] = av_strdup(arg); + if (!o->attachments[o->nb_attachments - 1]) + return AVERROR(ENOMEM); + return 0; } -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".