From patchwork Thu Sep 10 21:48:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22267 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 6F5A044B1C3 for ; Fri, 11 Sep 2020 00:51:58 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5AAB168B9F1; Fri, 11 Sep 2020 00:51:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5BDB968B8FA for ; Fri, 11 Sep 2020 00:51:51 +0300 (EEST) Received: by mail-wm1-f47.google.com with SMTP id w2so2143005wmi.1 for ; Thu, 10 Sep 2020 14:51:51 -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=SWrESOyNCFu8lchSRfdiKZu6QZuN3fOjU9amBwHPfEw=; b=aKgEKTxaZWYpPavQ3xHtzIXGWJGCgXEdfQA9/aGscHa7oJDwQ0PVHv7Qkjr1Na7jU8 4P4h6mq6KZAC7etvj88VNJoG5Cgx5JkNNEzKyEbNfC3nm4Y90ymGQKNT1RFCgAteVtUq mKGtNsjhWUu5U+zM0iG6tpUYHPQldXy4attaHhxXtXSM4PnfrAx0OZ/hOgrzcf/Ygdhe ZnMD6Wj3224s9rSG16JUCrroXZWF+j/afFAlgpCOSEcZhu7gz6MXSZIWfgDbrcPgRK03 0Q5O2cWMMv+ejmkuQdv/lSChCbZzX/Ni3/NtarCqGerz2qjPmL8bxLoUvVSY51OmRMeW WUlA== 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=SWrESOyNCFu8lchSRfdiKZu6QZuN3fOjU9amBwHPfEw=; b=nSAbwJsolsQ+5RHf8AKPQTl4dLLZYc87fwDgy168DM8wrMO19uRBD5Qg/N1nbyk71G 0fS1aZrHTx1pe4YRtHNt6fo0aBnTOdosfxFK8DrpKGnsXSXHLoFwvgzhUilwUrN3ksA6 s3I5rgFIqWnJeuO5TTMXPV3nA10WnG5h0ivdGNVxEnpEQU/+BuE6o0aeTuFxjiwslgcM TG6Gy8NR0EWTqnwQVO6bRLi+Z3p8+lOHev6erXYqUL5cWindeDmdjVzp5aHKqJvw5pox qBxrJkcNUoyaPpgOVy9uQRygnzGWiH/6+p5UXcrb1q3Cw+qjujdyIroCDR08jeFJPUjg 0d2A== X-Gm-Message-State: AOAM530tBFqo7NzUOr6hO7AC7WfiwM1tVK+WJ+u6w992jjH0dYwgZw41 lvRPFtHn3Qpup4CcMeVyI+Hx4gTnRoM= X-Google-Smtp-Source: ABdhPJw7kPJ1K9/Prk09ZLsVLtLmesiwSt06a5xEuuIapOxx2sXKR30Is7bsYTISgA0YieR0vD7oFw== X-Received: by 2002:a1c:6254:: with SMTP id w81mr2002579wmb.94.1599774710676; Thu, 10 Sep 2020 14:51:50 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id z203sm59232wmc.31.2020.09.10.14.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 14:51:50 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Sep 2020 23:48:55 +0200 Message-Id: <20200910214901.25401-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200910214901.25401-1-andreas.rheinhardt@gmail.com> References: <20200910214901.25401-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/9] avfilter/lavfutils: Avoid initializing packet 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" av_read_frame() can handle uninitialized packets. Signed-off-by: Andreas Rheinhardt --- libavfilter/lavfutils.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index d7de89f4b3..57af5ebfdc 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -35,8 +35,6 @@ int ff_load_image(uint8_t *data[4], int linesize[4], AVPacket pkt; AVDictionary *opt=NULL; - av_init_packet(&pkt); - iformat = av_find_input_format("image2pipe"); if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) { av_log(log_ctx, AV_LOG_ERROR, @@ -89,6 +87,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], } ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt); + av_packet_unref(&pkt); if (ret < 0 || !frame_decoded) { av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n"); if (ret >= 0) @@ -107,7 +106,6 @@ int ff_load_image(uint8_t *data[4], int linesize[4], av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h); end: - av_packet_unref(&pkt); avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); av_frame_free(&frame);