From patchwork Mon May 29 14:58:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Felt, Patrick" X-Patchwork-Id: 3759 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp1494608vsk; Mon, 29 May 2017 07:59:10 -0700 (PDT) X-Received: by 10.223.171.77 with SMTP id r13mr3641072wrc.83.1496069950277; Mon, 29 May 2017 07:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496069950; cv=none; d=google.com; s=arc-20160816; b=b1GMW6C9qOVHfIa+ojrBC2bSxEeSIBAPe+7TJRj4t5Yues7rW+sQCA9omivcbTVaUb iCP8Gdt8puJb5o7mVmWdL9nt7uJWKpiAMki/cki7h3wlkuMro9uVMt6lajdc6SR2N3mT uevanH6hu9Ny+SNkVlASbhUa/dXUgBk2nQTfW0N0ChPZUAKnVnNH2EdW42VC874RzoLD FjbF9QzQiFmbA3zdVXHaN/VM3z9h0utJ38bEAs0I2ZZQhzIwTZ6WCueCcRv0N+c3t+cE FYa+iWxoELR+kF3a8xswBIt+W7zB/tIFSJefaiOs1/zLoRTqB4N0dOf6oCE+OCj73oyk 0gdw== 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=Y+As05RLJOA9gim/AOVxaDaoPBvRJaW01LnpPR+hg4A=; b=cN2+Xr7FpcQv29NG1NJPSDFPXNUJew1NRndBacgiq5ojNguXdTvpE3Pc04FZ0UC75T iBGZwM/Chn4h7VwA8v3iU0ulD9QadaAqdE8Znl9t5TDkYH2u9mg+RUiGEjdRcJE1WVza d+3cYd0jUUtCuuU0zcr2iky/LcOEiljB+hQputnmUrV5Nlvbhf4jq2EnRZOoGECv1WL0 KKsvW9grnPCrYqEAnDQjdZfkWS38zZVyLZT1kk/3c5iPeNj3rvegA1j4wSEy56qZTffz CnLvsGtoD1KSZbETl2oWODScmZprwbB0fnmnIU/aj4gKsJ31Y+S0p2RY2fk6Cth5IpSB xraQ== 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 u144si12214192wmu.71.2017.05.29.07.59.09; Mon, 29 May 2017 07:59:10 -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 1C1C7680757; Mon, 29 May 2017 17:59:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mailin1.dish.com (mailin.dish.com [66.170.243.4]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F0200680702 for ; Mon, 29 May 2017 17:58:54 +0300 (EEST) X-IronPort-AV: E=Sophos; i="5.38,415,1491285600"; d="scan'208,217"; a="81976083" Received: from CHY-EXCHMBXP7.echostar.com (10.123.87.117) by CHY-EXCHCASP04.echostar.com (10.123.78.194) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 29 May 2017 08:58:56 -0600 Received: from CHY-EXCHMBXP6.echostar.com (10.123.87.116) by CHY-EXCHMBXP7.echostar.com (10.123.87.117) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Mon, 29 May 2017 08:58:56 -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; Mon, 29 May 2017 08:58:56 -0600 From: "Felt, Patrick" To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] RFQ on patch for decklink warnings Thread-Index: AQHS2IwYAb43VzAFmUix7TOTHCOvTw== Date: Mon, 29 May 2017 14:58:56 +0000 Message-ID: <47BFF55A-B4C8-469D-9120-11014441BA0F@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-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] FW: 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" bump From: ffmpeg-devel on behalf of "ffmpeg-devel-bounces@ffmpeg.org" Reply-To: FFmpeg development discussions and patches Date: Tuesday, May 23, 2017 at 4:06 PM To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] RFQ on patch for decklink warnings 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. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 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);