From patchwork Tue Apr 12 08:15:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 35284 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp1454578pzh; Tue, 12 Apr 2022 01:17:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5xqc/i1+8wiuR4FOObRh4TAAP/F0k7/HHPy5xxWEYuz4bDdHGGWAvT8/uQjMgcagUleOq X-Received: by 2002:a50:9eaa:0:b0:418:f708:f59c with SMTP id a39-20020a509eaa000000b00418f708f59cmr36943132edf.333.1649751423709; Tue, 12 Apr 2022 01:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649751423; cv=none; d=google.com; s=arc-20160816; b=kcPrIKo5lpv5Si+2mfSPh2pBH/cTq7ATyRPUt11GvWES5YemCU1fjej4MJM43wtAOh 5MFaYxBXpPYSKCZU99W6AlnjeKp/vkfT+nfJQrxhDxZlW13j0jNVSIm7LWwug+JgJiXg vjDPHcupXhECoJ+SrbJqP0CKSfw7kviYTmkV7F7C8r2Q+OzNbZ9ydgVl7CbuOZPXDj1o 3muB82iQxhLCt1p/VHfSViPA4NZyvixzBFdVN5t/WSC3TgEnPOkx1Y+rzUVQdmhCdFWU ZVAjZneJdUncH30h5/ec9K8WH2yUSBbmBpHDjibEqtMbjmgIXLEbOAnolnwgCyN4des0 E7bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=TIu5Z/j5EQj7CZAwlLgoDLfGHwCPyPqr2OPtaYu606o=; b=NR8UL25EWB8qCOkWS3NTT+64doFfbpkTbRmXG0DRWyIE7JAgY6zfJewCxY4V5FK2KM NVzdlWy1lx70VhVSBEUza1BmB8lothU/JLu2+GELYc61R3qkgm21tExqllCzV9TUtDsw xQB1NrOoZyx+x/+fB5VL2i8aqeXzQjtiJRcT07P7riECjSUCnqo0c3MJ8A2A5HArxRXX RAkX7xpMfjat/oPnuODFvNPF3FLJac/sjwYF5U+BskREyDD0xofFHlPL5HLI4YxGgfGu szG/LQBfOj+Ue6Us5eGih4diB4dtEeh680p3qgbGmXILeh0VH53Yo+IEt5F8b7gGIoRX QN8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="x/94/knX"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f17-20020a50ee91000000b0041d94730110si675173edr.278.2022.04.12.01.17.02; Tue, 12 Apr 2022 01:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="x/94/knX"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 51C4168B3B8; Tue, 12 Apr 2022 11:15:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-137.mail.qq.com (out162-62-57-137.mail.qq.com [162.62.57.137]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 449B368B393 for ; Tue, 12 Apr 2022 11:15:48 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1649751344; bh=zZKLgsJCBqD+N7dXZcBOAbDy5lc00IQKpuBg2z0pJAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=x/94/knXbilLjZlvrMmgiz4VSkvijCa+gebG983YdJ+8RSu73RsInKgDYjM41075E 7o1nbmjQ2iDzl/FrmRi0jBfM6wUokrghMiXlOsD0Cgmscp22wKvsNk1l327aJTEd16 FpqZKjMwICYKdJef8H3xxDrTX/syzh1umPZIob3w= Received: from ZHILIZHAO-MB2.tencent.com ([113.108.77.68]) by newxmesmtplogicsvrsza8.qq.com (NewEsmtp) with SMTP id 3E314CF9; Tue, 12 Apr 2022 16:15:35 +0800 X-QQ-mid: xmsmtpt1649751343tvk3ve4yo Message-ID: X-QQ-XMAILINFO: NC/J3CrDtaBbMRlk7BldDasSotUm60XrPQo/b9BtY3a6nhYlRBJMld3ksnHHV4 SloKBEAjKkc9AXo70kdDoUMhF397qlT2PRVdrxgtnwG6XoWPPwf+Cl2GtYlkzqc/sH5bc5kWTUs6 qFVXIJAfeGko9jCZoVjEnJPNJyrRAyXfNpmAChVSFA3zQGNxJEg99svqTc/lwkltoVseex06j9JB XZNHhdb+OJKj2SQtyhgogpITCF4oo43UNO/pVhZCgYqwlWR4VMh3fxud52M0PaeX5jBqboJxCPyN 9vEhx/dIqlV7BtTLbaUfqYE3FKEpkys4vx4+ekcVZioEPpK+l+gxFXmBUppUc0pB92+oeYr8pJf9 NrlxjwxLJUox4GoeGbsOT/O1yHYFsmVqK5Nesmz06eYGjgM0oNrtbeeTugrI0qzxgMP2tI/i1p6B qpjn4Xhu/AHLMA8L0NGXV7bLMK3JSrPpDnKnRn/W21cOd9NakXh+l1xMRkjHH3DKKnzL+vCYcmsy rv6GRuZkpdGCkwBqphLF5Myd8EMy5gd3Ex0YesKqzNRGzd1A9g/D31UlQGouOPSN616yUsMfS2bZ 2CdtPGwbDeFgT/ONID9snckWFp2ZFOQvMvFNQ3SPo90bxCHEc6fUH6hJvm5vCorPhA9WjFVxoNYE DfyR+gvGS6MCiqX08n2yB27KfrLcYsE/MKLvtKbB0E3+vwI9gG47xNh/mxrqjD9ZEO4Z7rixuL+L mhuM81tgS4eNs/i2tupAsrgIw17uVzDIK0ls5HvXSo4pRPg8w8Tjtg71EOrRnIFPMI9azYzoJTTq 5smOGVOxvY3yFYdq2OoTzES8ESYxd/jT+T139AOChrlMl56Zg63IcRvhR18hS6KIOtfRt3AvoedR 3d0RkI3g6S9TFwfu/S7F0KsHOsOgijcZBFPTeWCTmxGnJ3KRNYwnmiMepMUWFZAQ== From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Apr 2022 16:15:19 +0800 X-OQ-MSGID: <20220412081522.43246-7-quinkblack@foxmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412081522.43246-1-quinkblack@foxmail.com> References: <20220412081522.43246-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/10] avformat/hls: extract free_segment method X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lbWfmdlgytQx --- libavformat/hls.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 3ed6007d0d..65937120d5 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -225,13 +225,18 @@ typedef struct HLSContext { HLSCryptoContext crypto_ctx; } HLSContext; +static void free_segment(struct segment *segment) { + av_free(segment->key); + av_free(segment->url); + av_free(segment); +} + static void free_segment_dynarray(struct segment **segments, int n_segments) { int i; for (i = 0; i < n_segments; i++) { - av_freep(&segments[i]->key); - av_freep(&segments[i]->url); - av_freep(&segments[i]); + free_segment(segments[i]); + segments[i] = NULL; } }