From patchwork Fri Nov 29 19:44:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16490 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 AAB2F449BF4 for ; Fri, 29 Nov 2019 21:44:40 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 962A168B44A; Fri, 29 Nov 2019 21:44:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E67C68B42B for ; Fri, 29 Nov 2019 21:44:32 +0200 (EET) Received: by mail-wm1-f43.google.com with SMTP id b11so15204096wmj.4 for ; Fri, 29 Nov 2019 11:44:32 -0800 (PST) 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=uH9ZDBwaYF3CkC5F530UPNpN45UR22ShkTIs99RTG2k=; b=ELyPIbf53SHdCzlUNF4XkP0xR5goHJmqOZMO8P+rru04jEGhPWIIePdFhiQS3oCIE/ HKOlnbWu6/rLUC9yZYX7+4u9t6D/R03lO+YVHHr2lnpHagGWEZft8bU/iS9MuCJtcql5 b2iSUj+i8PwGhcMPJYLay2nYUx60LTE6EotHhg/noCLbvxTIEk8SOi1Gb+oFv3NlDH4t 3pzWasZK1Fo7UEkIUkuE+NigGZBERyRa8OmGJ8whC79eV0pc10Cd8rd+757hy+PtBJdh oZ1uoipH94TXTd413H2fykUeN3sBrRNo2DEzFMXDCm0OJNRc1X0M2ZUG+4hkvjEgG2Ci TbNQ== 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=uH9ZDBwaYF3CkC5F530UPNpN45UR22ShkTIs99RTG2k=; b=c8gPjvzU0ZtH75bccLWxTJgrBGhrd0Yjqy4MVlEbsNvNnW6VYS6/PQqx+RtR78QvUE 8NsmoWgnPgy+MkYHKeO14MFsMgP/bWVeDru8EQ2ix2G0m7VJkWEfLo4J4eri4pROJdTn Fo2wi9VJKc8PASvXFMrArLVwflzh4c0TcFPOaGZS/RK/muN/gUnaWcuV2voJSlVb/ULt zSsaeMPocrQLAUEkn6Ftx4FITz3SWk+zm3JWnS+vyM0WxgouoeD8MmCueaDG7zcNircf C9EKp9GSWgdNu/rT2hIIiITqSn7YleAb0kRjezxsmhOMarUWQGT1VymaOMGyM6pylS+q 4BOQ== X-Gm-Message-State: APjAAAU1TkzVwpC4w0GRn5S1b1G/ibGPGqHvKoE+/Rnco36vD3p6eQKZ 1bS/p7wXpq2N+vJGtSfeIiK/xb16 X-Google-Smtp-Source: APXvYqy3qFyi6F+DQycYzqpMBRv1rvyBRb2/fngWjgMWmRWH94CrikjAgWpkpA4h9OBGRQrFJNyGfg== X-Received: by 2002:a7b:cbc4:: with SMTP id n4mr16067551wmi.118.1575056671357; Fri, 29 Nov 2019 11:44:31 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08e23.dynamic.kabel-deutschland.de. [188.192.142.35]) by smtp.gmail.com with ESMTPSA id x7sm28059531wrq.41.2019.11.29.11.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2019 11:44:30 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Nov 2019 20:44:11 +0100 Message-Id: <20191129194411.20168-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191129194411.20168-1-andreas.rheinhardt@gmail.com> References: <20191129194411.20168-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/flac_picture: Return directly if nothing has been allocated 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" Signed-off-by: Andreas Rheinhardt --- libavformat/flac_picture.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c index ccb0ee613e..81ddf80465 100644 --- a/libavformat/flac_picture.c +++ b/libavformat/flac_picture.c @@ -52,7 +52,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) if (type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types)) { av_log(s, AV_LOG_ERROR, "Invalid picture type: %d.\n", type); if (s->error_recognition & AV_EF_EXPLODE) { - RETURN_ERROR(AVERROR_INVALIDDATA); + return AVERROR_INVALIDDATA; } type = 0; } @@ -63,8 +63,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) av_log(s, AV_LOG_ERROR, "Could not read mimetype from an attached " "picture.\n"); if (s->error_recognition & AV_EF_EXPLODE) - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; + return 0; } if (len + 24 > bytestream2_get_bytes_left(&g)) { av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n"); @@ -86,8 +86,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n", mimetype); if (s->error_recognition & AV_EF_EXPLODE) - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; + return 0; } /* picture description */ @@ -100,7 +100,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) } if (len > 0) { if (!(desc = av_malloc(len + 1))) { - RETURN_ERROR(AVERROR(ENOMEM)); + return AVERROR(ENOMEM); } bytestream2_get_bufferu(&g, desc, len);