From patchwork Mon Sep 7 02:49:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22139 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 9EEB744BB3D for ; Mon, 7 Sep 2020 05:51:20 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 892E768A687; Mon, 7 Sep 2020 05:51:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2B6EB689F10 for ; Mon, 7 Sep 2020 05:51:13 +0300 (EEST) Received: by mail-ej1-f66.google.com with SMTP id i26so16158657ejb.12 for ; Sun, 06 Sep 2020 19:51:13 -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=ue3jms1eJJoPbgbUG3Ad0hiCicJhXE0ocV5BJlgf3xM=; b=PNgW6UGg8lZS6hNJtc63sx/y5txq0cIMzOhwri+UzaguawCWRdmGhQKRA7I0GoTm0l Qct8nWfFSik/HtE1uI8r9L4YEdECbjbZv5mcYlY5NcHPset+gmTv9RMuhUUFhZxMkDat yrXKMZbgumxBzEdRgonDeqVkL3PLBxlP2GMvUFq/ZEdG65ixleTN9BstfMv013sZfSws omUIFUu10sq6pJmv+yLpgtg0SDWeWeVez0Nwd1S2DE6yoD3rOz/giPWCLL7sqi/xHhkf 6IGzf3SZSziBuQVmOqJ/zYLprSdrUb0tZYdLdWXpIMcCSwjf2gfTz3T48e9r3fA02opP /cnQ== 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=ue3jms1eJJoPbgbUG3Ad0hiCicJhXE0ocV5BJlgf3xM=; b=ekg/i0dw4EqOvgOrBCS97Ow1U03h3praxK1l4IjhS+ObqzG3toE1lCSe7sogezjHQz w2fLI9Q+p3qrf+5GuvZOXNhqFw2nhOJgaXmauOHy4GtvX2wbybyLegvMB/m0EKJZJXoW fGusnsWR9lJEEckNgXXjzfGnqafAeCYUY8Elu+awITAmaDMhag8Gh6x0r6x+L/G4XIuU atEcfnR9p2esl9WgnNiKuX+eScaxYbhB/V9H8umRx2mtw63FGcbWZH4oyf1kMxQmSpSu 80gQR0GwgNd5DVvJyH8PTXb/joFvRuDY4h+RvRpgQA0iN+RQ59PxBhKX9yFAPwK2eb1Q uSyg== X-Gm-Message-State: AOAM530G6pV+ksOzDu5F3e9r+yp9d3hsIs/R6QYBLCV2tRpCAacGh74d RnsO8xBevpj32KMRqnRRRnWKz5I1wHY= X-Google-Smtp-Source: ABdhPJwQb6OtNGobBYhEm1boGTsNa4BbpnXv3fNV9Ky9Xr9xY2C3qv448e3e/o7fLHtWFnQT2ws2TQ== X-Received: by 2002:a17:906:b317:: with SMTP id n23mr18585140ejz.6.1599447072371; Sun, 06 Sep 2020 19:51:12 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id a15sm13802048eje.16.2020.09.06.19.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 19:51:11 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Sep 2020 04:49:50 +0200 Message-Id: <20200907024952.11697-8-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200907024952.11697-1-andreas.rheinhardt@gmail.com> References: <20200907024952.11697-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/10] avformat/segment: Remove redundant code for freeing in write_trailer 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" This code mostly duplicates code in the deinit function; the only exception is av_opt_free(): The options are freed generically lateron. Signed-off-by: Andreas Rheinhardt --- libavformat/segment.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index d895e6a678..0253b750b8 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -991,30 +991,21 @@ static int seg_write_trailer(struct AVFormatContext *s) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; - int ret = 0; + int ret; if (!oc) - goto fail; + return 0; if (!seg->write_header_trailer) { if ((ret = segment_end(s, 0, 1)) < 0) - goto fail; + return ret; if ((ret = open_null_ctx(&oc->pb)) < 0) - goto fail; + return ret; seg->is_nullctx = 1; ret = av_write_trailer(oc); - close_null_ctxp(&oc->pb); } else { ret = segment_end(s, 1, 1); } -fail: - if (seg->list) - ff_format_io_close(s, &seg->list_pb); - - av_opt_free(seg); - - avformat_free_context(oc); - seg->avf = NULL; return ret; }