From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BC63440533 for ; Tue, 21 Dec 2021 11:55:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D7BF868A82A; Tue, 21 Dec 2021 13:55:56 +0200 (EET) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A539E68998A for ; Tue, 21 Dec 2021 13:55:50 +0200 (EET) Received: by mail-ua1-f52.google.com with SMTP id o1so23219837uap.4 for ; Tue, 21 Dec 2021 03:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=JUojhu9Zrl/31B+EQUFUXeUcRE3Ww2co/DDe9P4nPdw=; b=AEAYfaCowJSKzlgJQJpi6Gkgt48XKX+Qd/szdGKOItbNdxCQDDZAiKJHh5MHgInHPM 6h02kYnGGtqYYVAUsAScSeXVQHZTfjkFv/fbhslBUvZ81RiSGFyM2/eVuFRO8nTDLKvt qqQxpuOTjnmH/yukbof31csHNbvFOS9zCX2nQbH77svyjjtgJxb0JJLLtEilH5OA74mF TjCDQetjVokUpWdpObFeISfhZudg+0O8V5lQ17q73Dc1C9VdCXkmK+wT4/Lflofqlqau k50NkJ+V6leGJ/dholeDczxg0sHX/JrgTzCyskHgDU/HHFxGcTX7NvVrvKRu9uNLHrJ5 jAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=JUojhu9Zrl/31B+EQUFUXeUcRE3Ww2co/DDe9P4nPdw=; b=YqiRC5Hch34Qs5MTPVurX6+idv3bqXTndwZ6Ox++Td4P2X/vB045Ud0YbxoqPk+ReE yTYSlV/PrB2kiBFvGFWHLT6U6dWPKspKjfU8omZpmGFoYiq+TkIVHJwRg0AJaymGLyR6 3aAxf7vtnWvgKuHtpMGw9r+bxChL3XHUv0/+76o+Tx7/LzdBpRZmVf1GQE84ZshgW+Ny sRJ275Ed1car3lglkof9DZ1EJHtw9AR9hLduSqqe25A8Kf7ckLJuTczZd73wws7RUJH+ ZOijAV9QIZWSF6q1iIlyWLF3l/GmdZtDMvWJ6RkhE9Jy1IXG+zSNS6wH7iYxIE8MKgCl h8Ug== X-Gm-Message-State: AOAM530BA2AzLTRuOK/DJCUTZ7F6xQnbhFHQwqWb29BIYgU12psueF2L hYy7FvT0si0Aebn4GxQ4/l7susvC2z3hbgWRPr5iiYRFvSA= X-Google-Smtp-Source: ABdhPJxl4+OC9vpmBFYkCKRQEFpD18neP6RRWayzuPyIgzteycMxp9Y5v2D3w0LUKqwLp8PJAHHrSGuLSpbIu1zrjc0= X-Received: by 2002:ab0:6482:: with SMTP id p2mr1027224uam.85.1640087747971; Tue, 21 Dec 2021 03:55:47 -0800 (PST) MIME-Version: 1.0 References: <20211219192134.1296-1-dcnieho@gmail.com> <20211219192134.1296-11-dcnieho@gmail.com> In-Reply-To: From: "Diederick C. Niehorster" Date: Tue, 21 Dec 2021 12:55:30 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v5 10/13] avdevice/dshow: add media type info to get_device_list 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Hi Andreas, On Mon, Dec 20, 2021 at 9:01 AM Diederick C. Niehorster wrote: > > On Mon, Dec 20, 2021 at 2:04 AM Andreas Rheinhardt > wrote: > > > > Diederick Niehorster: > > > // store to device_list output > > > if (av_reallocp_array(&(*device_list)->devices, > > > (*device_list)->nb_devices + 1, > > > @@ -412,6 +417,8 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum, > > > av_freep(&device->device_name); > > > if (device->device_name) > > > av_freep(&device->device_description); > > > + if (device->media_types) > > > + av_freep(&device->media_types); > > > > You are duplicating freeing code here: You have code to free media_types > > both before it was put into device and after; you can avoid the latter > > by only attaching media_types to device when nothing else can fail. > > I could indeed avoid adding av_freep(&device->media_types) when only > attaching media_types to the device once it made it into the device > list array (so doing > (*device_list)->devices[(*device_list)->nb_devices]->media_types = > media_types). But that makes the code harder to read (asymmetric, > everything else is attached to the device before it goes into the > list) and the missing free while the other device members are freed > looks like a code smell. I think this is easier to read and less error > prone for future patches when done as currently. Nevermind, with some reordering, i see i can do as you suggest. Will do. Cheers, Dee _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".