From patchwork Tue Jan 1 21:22:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 11631 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 2B19E44DEE1 for ; Tue, 1 Jan 2019 23:22:48 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D253768A4DD; Tue, 1 Jan 2019 23:22:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 473EF68A448 for ; Tue, 1 Jan 2019 23:22:38 +0200 (EET) Received: by mail-qk1-f174.google.com with SMTP id d15so2538182qkj.0 for ; Tue, 01 Jan 2019 13:22:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=oZox/x5gWTraFV3uPf5jvvV77oAPRpQYoGWTbnn+7+w=; b=CQ6pdqTml76Ryz0mrXJbT5XLWcZgXbFstIcNlWQci2lzPDevEhBOWmIBPaqtuBzOxV hydWgJxcSycD17xXIFjCtBZg8Ly9TsJpXxOJDy+MM0ptWzp+TOK3XtV1KpQl8sgBztXw yMTmvzgRJKz7rYeLB4TQXX2KMe/1cXCPQe0Lg8A3xBVo9SYkCX2b9fxUzkA37I7VDXA4 qhphkrfj9OQ+CwmWoAAE44nmUDmpI+xsmRFfxLAX52eSOzlceN/Ic+fk3j7CgWBHsRp3 l6992D0sC3wqJrShq+1DVesetSGxY6GNOdGEMtYUysJlTOu7/bA6oEq5WrnbbDDTV8PQ ldyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=oZox/x5gWTraFV3uPf5jvvV77oAPRpQYoGWTbnn+7+w=; b=ZOWjS8ISZUphMjHQOWgcB407Wth2OWTv2dq53BVlohPGqGP/3NJYVu0S4rFl+UeGTR HE42L2huata9K++LBBDgMxuO4DgddfvPb+gI0nlmQLUroNnMyoKnkoFxYi2GmHj0UjHp KHIUheSYtCvFw3qrH7fGgUM9sM12KRlJiMIBiLEugrmBcreQdRsiMlIwe5F+j9GabUA/ PS9etYkqWmHsQv/QZSkgoejoiwHk8SRQGKnanNvlO/0ZJMBFhGfZoV8TYA3iWe+mrncI wc7onj0EmcNDK9xd1iJgAoT4q/8dZMalu+9zQxfTX2xFwOQOOqyMzgx0NknkW/A8FuOb xEdg== X-Gm-Message-State: AJcUukd/49rEj/WhukHC0ehvG1dNpnHiM+FDP1qfkH4YixJlgdGZDfjG jEFmR1c3kl8kQUdA0ZqybtlyDrdt X-Google-Smtp-Source: ALg8bN4LJNXLoKpmNZVZSsyhzWkXBqot78KaqCcbpOz5F0H84e+GWVD9D2hlAWeCLDW7UDikhnWDCg== X-Received: by 2002:a37:2c02:: with SMTP id s2mr38811649qkh.59.1546377765000; Tue, 01 Jan 2019 13:22:45 -0800 (PST) Received: from [192.168.1.46] ([179.38.243.129]) by smtp.gmail.com with ESMTPSA id m6sm5949128qkm.30.2019.01.01.13.22.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jan 2019 13:22:44 -0800 (PST) To: ffmpeg-devel@ffmpeg.org References: <54FC7158-A35F-41FE-AA48-4C0D66AFB456@mac.com> <20190101211643.GC7547@sunshine.barsnick.net> From: James Almer Openpgp: preference=signencrypt Message-ID: Date: Tue, 1 Jan 2019 18:22:42 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190101211643.GC7547@sunshine.barsnick.net> Content-Language: en-US Subject: Re: [FFmpeg-devel] Possible memory leaks in dshow capture 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 1/1/2019 6:16 PM, Moritz Barsnick wrote: > On Tue, Jan 01, 2019 at 17:58:42 -0300, James Almer wrote: >> Does the attached (untested) patch fix these two for you? > [...] >> + if (!this) >> + return >> + av_freep(&this->imemvtbl); > > Do add a semicolon after "return" for good measure. ;) > > Moritz Huh, curious, gcc 8 (mingw-w64) compiled this just fine without the semicolon. I'm attached a fixed version anyway. diff --git a/libavdevice/dshow_pin.c b/libavdevice/dshow_pin.c index 664246da92..c0f8ec065d 100644 --- a/libavdevice/dshow_pin.c +++ b/libavdevice/dshow_pin.c @@ -249,8 +249,16 @@ libAVPin_Setup(libAVPin *this, libAVFilter *filter) return 1; } + +static void +libAVPin_Free(libAVPin *this) +{ + if (!this) + return; + av_freep(&this->imemvtbl); +} DECLARE_CREATE(libAVPin, libAVPin_Setup(this, filter), libAVFilter *filter) -DECLARE_DESTROY(libAVPin, nothing) +DECLARE_DESTROY(libAVPin, libAVPin_Free) /***************************************************************************** * libAVMemInputPin