From patchwork Tue Mar 15 16:33:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 597694 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qPgDH1cfrz9sBM for ; Wed, 16 Mar 2016 03:33:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934615AbcCOQdk (ORCPT ); Tue, 15 Mar 2016 12:33:40 -0400 Received: from mail.us.es ([193.147.175.20]:33690 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934250AbcCOQdk (ORCPT ); Tue, 15 Mar 2016 12:33:40 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 0806B114F50 for ; Tue, 15 Mar 2016 17:33:30 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id E70F0DA392 for ; Tue, 15 Mar 2016 17:33:29 +0100 (CET) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id DA7E1DA380; Tue, 15 Mar 2016 17:33:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-103.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id E96C5DA392 for ; Tue, 15 Mar 2016 17:33:27 +0100 (CET) Received: from 192.168.1.13 (192.168.1.13) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/522/antivirus1-rhel7.int); Tue, 15 Mar 2016 17:33:27 +0100 (CET) X-Virus-Status: clean(F-Secure/fsigk_smtp/522/antivirus1-rhel7.int) Received: (qmail 11120 invoked from network); 15 Mar 2016 17:33:27 +0100 Received: from 129.166.216.87.static.jazztel.es (HELO salvia.here) (pneira@us.es@87.216.166.129) by mail.us.es with SMTP; 15 Mar 2016 17:33:27 +0100 From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: fw@strlen.de Subject: [nft 3/3] parser_bison: release parsed type and hook name strings Date: Tue, 15 Mar 2016 17:33:18 +0100 Message-Id: <1458059598-7470-3-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458059598-7470-1-git-send-email-pablo@netfilter.org> References: <1458059598-7470-1-git-send-email-pablo@netfilter.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The scanner allocates memory for this, so release them given that we don't attach them to any object. ==6277== 42 bytes in 6 blocks are definitely lost in loss record 2 of 4 ==6277== at 0x4C28C20: malloc (vg_replace_malloc.c:296) ==6277== by 0x57AC9D9: strdup (strdup.c:42) ==6277== by 0x41B82D: xstrdup (utils.c:64) ==6277== by 0x41F510: nft_lex (scanner.l:511) ==6277== by 0x427FD1: nft_parse (parser_bison.c:3690) ==6277== by 0x4063AC: nft_run (main.c:231) ==6277== by 0x40600C: main (main.c:361) Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parser_bison.y b/src/parser_bison.y index 0592b68..9e86f26 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -1107,12 +1107,16 @@ hook_spec : TYPE STRING HOOK STRING dev_spec PRIORITY prio_spec state->msgs); YYERROR; } + xfree($2); + $0->hookstr = chain_hookname_lookup($4); if ($0->hookstr == NULL) { erec_queue(error(&@4, "unknown chain hook %s", $4), state->msgs); YYERROR; } + xfree($4); + $0->dev = $5; $0->priority = $7; $0->flags |= CHAIN_F_BASECHAIN;