From patchwork Sat Sep 26 10:28:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22617 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 7B8B444B313 for ; Sat, 26 Sep 2020 13:32:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D6BB68B745; Sat, 26 Sep 2020 13:30:20 +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 D4D3268B7CA for ; Sat, 26 Sep 2020 13:30:16 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id x14so6585401wrl.12 for ; Sat, 26 Sep 2020 03:30:16 -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=fEyjse7kLEuk/7KwJt+dhNvKw/TdeJzj1Hmwp6yfg34=; b=JLxw/Ld67tAM4RQG9HYzwe4vf50VlZlzwzZfn3ZWbxHtKeRKJ8iPzbdYyQr2fneEnn dem6wqCl3brpCbzJxjgk3NR/mFDey3Agh8WrQeRkj/+Dtdu6UalTqeAtb84ONTWuyI0a FThCaChjhfddf59DVXDG4F4a50SLOUJPVK+IiiCQiOpiE+dEiLx151uKEUfPQwd4Anci m9JSBSEh3GLRPnmH5bU/SrXDepiHc6YBQeUALbO6xNHmNWqGVh//tWl1Ha/+IiTwDfkP 5GVxrDOdVxwGUVIxWCzoHaCY6tqFZzhU5w3Ggca8vdmnx8uJffexuMB045eNP0Ngl6nO yaLw== 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=fEyjse7kLEuk/7KwJt+dhNvKw/TdeJzj1Hmwp6yfg34=; b=qarqdTP02kZSjLrc3EoQ/7qn62ghLwfSCGymNmsYBpHHecRtriZ47FF8OjM5yr0Q13 Ja81VARN1p3EenulDh8XG2GF21q9bV5Q+rO1AT+YliCJ5zHT6Ji7XbUK3aA7BvbNrroB FU9O4dxw7ePCNKd2cSp48VNxAv52iojgni+omhaWsEqK0afDcKl7koRIz+wWuTqTfEWf ecSK1wHHf+ZSjWnwkRi5j9MWrc+c49+WRAYn/7zjTPPuuHb3Zl4lEWR3x3qyZcoTWIKz 0eFlkvMnlaRv4MEZzXQ3/XCdcgtQIxdRhk0IT8iZpcVZc3ANjK99sh8JjykbjU1Ii10W gy6w== X-Gm-Message-State: AOAM531qqomcIKiRMTgOYoA0Fw7Tpdrjr5zcnU4HOsvaC4OoK7mnywL+ s/n3Wt5aFKid3grPxRMJ2tgvGiDFgWo= X-Google-Smtp-Source: ABdhPJzAN2Ju73qMd3uscOo1MyNuuAcb19MJypgmTJ2ralo1DQhJblyQPh7Ukgg8z1a5IvcYpPx+MQ== X-Received: by 2002:a5d:43cf:: with SMTP id v15mr9118268wrr.269.1601116215998; Sat, 26 Sep 2020 03:30:15 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k8sm6064867wrl.42.2020.09.26.03.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:15 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:28:00 +0200 Message-Id: <20200926102804.228089-21-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> References: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 21/25] avcodec/utils: Don't forget cleaning up when allocating priv_data fails 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" Allocating an AVCodecContext's priv_data used to be the first object allocated in avcodec_open2(), so it was unnecessary to goto free_and_end (which does the cleanup) upon error here. But this is no longer so since f3a29b750a5979ae6847879fba758faf1fae88d0. Signed-off-by: Andreas Rheinhardt --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a8af45d0c3..05064b560f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -608,7 +608,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); - goto end; + goto free_and_end; } if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class;