From patchwork Wed May 22 01:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13229 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 CF949448570 for ; Wed, 22 May 2019 04:13:41 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8D6D68A90D; Wed, 22 May 2019 04:13:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C79BC68A874 for ; Wed, 22 May 2019 04:13:38 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id t5so406179wmh.3 for ; Tue, 21 May 2019 18:13:38 -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=MCsNkFVm8m9gDWcjIxHyfXp+1KQQfng5lYAT72nk4mY=; b=gQX5OUVIbrNc7JrSlh65ez85avaw/S+r/2GixEx0wUGfILiOuT0i37w6+inP+StkGB N7o0Ns0/iaTjSOxzFGh0XmCT6CzMIHRWZokH0VrgVAXmaZnZlDyrp19rs9/of/DPx/X4 ijFf2ImJtgacPQlpHLNw9iYtOzYXs2LRbeEw8nDoOqgayqIQFb91qYIRHuish6K25kg+ o5XDf8yRGXTLlU7Dl3A5iiAQ3FvyYOu/+5t4m2ttqa9i+Cnfqj4z2+Dhby/1JkFcNbQg k7QwR4oXbNXD/vhNF3x2BOXsVhBumLannPpuzMKd9ZS5teSRcwYYc0mnU13cHAItMIKo IQ0g== 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=MCsNkFVm8m9gDWcjIxHyfXp+1KQQfng5lYAT72nk4mY=; b=V8YE1YiSPMAJxa/Lh9wIeD430QiNZIVItN3atLEPqHEXxidSBwBg/b+QHRfd9kxWlM 7uZnqSQXGg/miOKpe9LmEN3m7Hp+irNYl/oaEs87P+HH06QRtE2DnV5USDQ0eUIs0/Vn aLxGn+CDnLQn4+gsYVxf9lsCww+6fHHlUf6cn6xqQV6pYW6yf2Bhxrd5056JHyuOi59F omRKVOKun2o5N9eo5o80ohZVV4kw/KejIgxnifoovJ8g5dvhKXXkh6X+Qq7stfnJI5R9 OhREj1RyQrOcodxvLRveFLSYtUnfNds0F8ycrLJNhQhn9U4t/8JoUSiDVTxp6CsMrGQa P/rA== X-Gm-Message-State: APjAAAXrIebg1bANcm82XTF/Bc4ArhhGmSs3c4e/Jxhl7rLDauHpph1c 406rbfswR8iOIZ9HAuC4ozYQW+6I X-Google-Smtp-Source: APXvYqz8dJQVT2IVjBMqmKW9K7K3SGLzDUUgMZeAcTXnu7HWtFe9S9CX0VuBrG0jRqlc1t3pVQwIsw== X-Received: by 2002:a05:600c:24a:: with SMTP id 10mr5204392wmj.100.1558487617815; Tue, 21 May 2019 18:13:37 -0700 (PDT) Received: from localhost.localdomain (ipbcc18715.dynamic.kabel-deutschland.de. [188.193.135.21]) by smtp.gmail.com with ESMTPSA id z1sm8614486wrl.91.2019.05.21.18.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 18:13:37 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 May 2019 03:04:36 +0200 Message-Id: <20190522010441.44257-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190522010441.44257-1-andreas.rheinhardt@gmail.com> References: <20190522010441.44257-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/11] cbs, cbs_mpeg2, cbs_jpeg: Don't av_freep local variables 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" There is no danger of leaving dangling pointers behind, as the lifespan of local variables (including pointers passed (by value) as function arguments) ends anyway as soon as we exit their scope. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs.c | 2 +- libavcodec/cbs_jpeg.c | 8 ++++---- libavcodec/cbs_mpeg2.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 0260ba6f67..fc2246970e 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -97,7 +97,7 @@ int ff_cbs_init(CodedBitstreamContext **ctx_ptr, ctx->priv_data = av_mallocz(ctx->codec->priv_data_size); if (!ctx->priv_data) { - av_freep(&ctx); + av_free(ctx); return AVERROR(ENOMEM); } diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 5a72f0e2e7..b74747cbbf 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -86,21 +86,21 @@ static void cbs_jpeg_free_application_data(void *unit, uint8_t *content) { JPEGRawApplicationData *ad = (JPEGRawApplicationData*)content; av_buffer_unref(&ad->Ap_ref); - av_freep(&content); + av_free(content); } static void cbs_jpeg_free_comment(void *unit, uint8_t *content) { JPEGRawComment *comment = (JPEGRawComment*)content; av_buffer_unref(&comment->Cm_ref); - av_freep(&content); + av_free(content); } static void cbs_jpeg_free_scan(void *unit, uint8_t *content) { JPEGRawScan *scan = (JPEGRawScan*)content; av_buffer_unref(&scan->data_ref); - av_freep(&content); + av_free(content); } static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, @@ -227,7 +227,7 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, data, data_size, data_ref); if (err < 0) { if (!data_ref) - av_freep(&data); + av_free(data); return err; } diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 4f89435c9d..df2e818f07 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -146,7 +146,7 @@ static void cbs_mpeg2_free_user_data(void *unit, uint8_t *content) { MPEG2RawUserData *user = (MPEG2RawUserData*)content; av_buffer_unref(&user->user_data_ref); - av_freep(&content); + av_free(content); } static void cbs_mpeg2_free_slice(void *unit, uint8_t *content) @@ -154,7 +154,7 @@ static void cbs_mpeg2_free_slice(void *unit, uint8_t *content) MPEG2RawSlice *slice = (MPEG2RawSlice*)content; av_buffer_unref(&slice->header.extra_information_ref); av_buffer_unref(&slice->data_ref); - av_freep(&content); + av_free(content); } static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx,