From patchwork Wed Apr 9 22:26:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 3957871 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AFE69BFF02 for ; Wed, 9 Apr 2014 22:28:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDFD820637 for ; Wed, 9 Apr 2014 22:28:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11E9220513 for ; Wed, 9 Apr 2014 22:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934143AbaDIW15 (ORCPT ); Wed, 9 Apr 2014 18:27:57 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:58856 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933721AbaDIW1X (ORCPT ); Wed, 9 Apr 2014 18:27:23 -0400 Received: by mail-ee0-f44.google.com with SMTP id e49so2375150eek.31 for ; Wed, 09 Apr 2014 15:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=CNHk8kc6n8Ahr9PevJoAhHeHos40Et+43088HlWxDCA=; b=sWm7z6GIMtCEIfNQwgMnSy6Z0yXyednlVqwWo9qFMH65+VtZ//tZUUVA664FnF6s+6 6/LSwrb/QZ6oiWhVm2YMrUK80oiuJLwZutimIrc7Hhgm4CYZ+F0w7ppn9rF9Vui23DVD rM6hbxB609HoVFM7AU0rzTjxClFKelxG0cg6S6UllIltJgsvGG601xoWTYz1W3CfkoBc DwoObtELwtqI32/+euarOq584RHIT114k7Mz29QPEdwAlE9b7Di+Jq5Vx7UJsQguYcuw WJStAf49hlpxScu8ncW2Qphbvp56kGXRiA2HCjvue58PE/F4X1x3IzskEqOzrpDPMISb OpCQ== X-Received: by 10.14.225.73 with SMTP id y49mr15250797eep.43.1397082442590; Wed, 09 Apr 2014 15:27:22 -0700 (PDT) Received: from exciton.exnihilo. (29-206.60-188.cust.bluewin.ch. [188.60.206.29]) by mx.google.com with ESMTPSA id t44sm5306199eeo.6.2014.04.09.15.27.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Apr 2014 15:27:22 -0700 (PDT) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 4/7] libdvbv5: make dvb_table_filter_free public Date: Thu, 10 Apr 2014 00:26:57 +0200 Message-Id: <1397082420-31198-4-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397082420-31198-1-git-send-email-neolynx@gmail.com> References: <1397082420-31198-1-git-send-email-neolynx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP make dvb_table_filter_free public so it can be used by applications. fix potential double free. Signed-off-by: André Roth --- lib/include/libdvbv5/dvb-scan.h | 2 ++ lib/libdvbv5/dvb-scan.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h index 206d409..f0af9d7 100644 --- a/lib/include/libdvbv5/dvb-scan.h +++ b/lib/include/libdvbv5/dvb-scan.h @@ -74,6 +74,8 @@ struct dvb_table_filter { void *priv; }; +void dvb_table_filter_free(struct dvb_table_filter *sect); + int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd, unsigned char tid, uint16_t pid, void **table, unsigned timeout); diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index e522225..d8b3953 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -158,10 +158,12 @@ static int dvb_parse_section_alloc(struct dvb_v5_fe_parms *parms, return 0; } -static void dvb_parse_section_free(struct dvb_table_filter *sect) +void dvb_table_filter_free(struct dvb_table_filter *sect) { - if (sect->priv) + if (sect->priv) { free(sect->priv); + sect->priv = NULL; + } } static int dvb_parse_section(struct dvb_v5_fe_parms *parms, @@ -280,7 +282,7 @@ int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd, if (!buf) { dvb_perror("Out of memory"); dvb_dmx_stop(dmx_fd); - dvb_parse_section_free(sect); + dvb_table_filter_free(sect); return -1; } @@ -327,7 +329,7 @@ int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd, } while (!ret); free(buf); dvb_dmx_stop(dmx_fd); - dvb_parse_section_free(sect); + dvb_table_filter_free(sect); if (ret > 0) ret = 0;