From patchwork Tue May 23 22:06:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Felt, Patrick" X-Patchwork-Id: 3730 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp466801vsk; Wed, 24 May 2017 12:15:00 -0700 (PDT) X-Received: by 10.28.131.213 with SMTP id f204mr7023281wmd.26.1495653300191; Wed, 24 May 2017 12:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495653300; cv=none; d=google.com; s=arc-20160816; b=KBJ7c6UC6BKfSQenn84+M8Up3ttPZbGQfIfqVkF27q4kfCSrEKqvugHwfsSCDUIcZF /HwSzKKj8e2udmvXUfcHJF7FJCgfpTNQtMzPF5CzSu8VVK+/R7q4yJ+oT25kemt4bl/8 n8SMJ5+p+FbDhxy2KxVFloz7Ql4xt/v/98Y6QnqEOCfgTk/uRDY/iXrBa2WjGx/qyy+6 vP8MRP6HwXmxIkO2FdaQsA5y/6b0cYpyFd2cdW7CutYnWb7TZzL+3EIgqiArlpFDSlf7 g9ualHx6XYTpPW/SsXHHVweL/3Van5IK73fY2hcoHXodnwDr3Yq8mbAFC+7nxvmOzsrq LlfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:content-language:accept-language :message-id:date:thread-index:thread-topic:to:from:delivered-to :arc-authentication-results; bh=IahBDg94xLggtNFEJCMCzCtxn1/0BOybsAF5KqOTXTw=; b=LBGiicWpmVzRJp0Ku2/Clvnv2kIrpzIV0JkerHonhg32lnZeZIdpKvpdz/iF1Qt3vx lIImb95ev3+JiFKaqmyV0xDK94cSav73e4BQoKGtBm6N9bsG3CyAW4sWzJ4vdKrVkVPT vXW19PoOUcUl/fy66tvD3Ovj7+XLxUSgKj2qSuFMxcumwqEFkAnnAD4s0ZdBB/WqESFX it5egAwmEwpET8e/Wf9W3QBtaeaObLkIpjk/WwQXwVOfnHMEc2j0C/PoxtJ4700Fu9zx G7lKMnb1GaYwi3xkG0uophnNTbgGYX4b3B9IEeufnQJHUC374wSmmC62p/g2HUpA1JXG Hxzg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f8si9182775wrf.148.2017.05.24.12.14.59; Wed, 24 May 2017 12:15:00 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43A18689B94; Wed, 24 May 2017 22:14:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mailin3.dish.com (mailin.dish.com [66.170.243.4]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E1373688379 for ; Wed, 24 May 2017 01:06:40 +0300 (EEST) X-IronPort-AV: E=Sophos; i="5.38,383,1491285600"; d="scan'208,217"; a="71349280" Received: from CHY-EXCHMBXP4.echostar.com (10.123.87.114) by CHY-EXCHCASP02.echostar.com (10.123.78.192) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 23 May 2017 16:06:38 -0600 Received: from CHY-EXCHMBXP6.echostar.com (10.123.87.116) by CHY-EXCHMBXP4.echostar.com (10.123.87.114) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 23 May 2017 16:06:37 -0600 Received: from CHY-EXCHMBXP6.echostar.com ([10.123.87.116]) by CHY-EXCHMBXP6.echostar.com ([10.123.87.116]) with mapi id 15.00.1130.005; Tue, 23 May 2017 16:06:37 -0600 From: "Felt, Patrick" To: FFmpeg development discussions and patches Thread-Topic: RFQ on patch for decklink warnings Thread-Index: AQHS1BDZrNau3u0xkk+M/0NamjMBeA== Date: Tue, 23 May 2017 22:06:37 +0000 Message-ID: <20D1B1B3-BFC7-4838-BD4A-968881A10095@dish.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [67.21.131.57] MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 24 May 2017 22:14:50 +0300 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] RFQ on patch for decklink warnings 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" Afternoon all, I’m looking at fixing some warnings on deprecated api calls in the decklink drivers. I’ve got a patch ready, but it looks like I might be leaking memory somewhere. In the old code using the av_dup_packet() is a free() of some kind required in code that I might be able to look for and unref() ? Here is the current patch, not looking for a commit on it, just discussion in what I’m missing. diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 39974e3..47cef29 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -122,16 +122,16 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); return -1; } - /* duplicate the packet */ - if (av_dup_packet(pkt) < 0) { + + pkt1 = (AVPacketList *)av_mallocz(sizeof(AVPacketList)); + if (!pkt1) { return -1; } - pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList)); - if (!pkt1) { + /* duplicate the packet */ + if (av_packet_ref(&pkt1->pkt, pkt) < 0) { return -1; } - pkt1->pkt = *pkt; pkt1->next = NULL; pthread_mutex_lock(&q->mutex);