From patchwork Wed Jan 2 13:13:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10746363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74BA5746 for ; Wed, 2 Jan 2019 13:15:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6121E2884B for ; Wed, 2 Jan 2019 13:15:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 531152885E; Wed, 2 Jan 2019 13:15:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F059A2884B for ; Wed, 2 Jan 2019 13:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729474AbfABNO7 (ORCPT ); Wed, 2 Jan 2019 08:14:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbfABNO7 (ORCPT ); Wed, 2 Jan 2019 08:14:59 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5ED1A80F75; Wed, 2 Jan 2019 13:14:59 +0000 (UTC) Received: from localhost (ovpn-12-97.pek2.redhat.com [10.72.12.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4B32450A; Wed, 2 Jan 2019 13:14:58 +0000 (UTC) From: Honggang Li To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [ibsim patch 21/23] sim_net.c: Free pattern buffer Date: Wed, 2 Jan 2019 21:13:16 +0800 Message-Id: <20190102131318.5765-21-honli@redhat.com> In-Reply-To: <20190102131318.5765-1-honli@redhat.com> References: <20190102131318.5765-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 02 Jan 2019 13:14:59 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ==11591== 9,824 (1,792 direct, 8,032 indirect) bytes in 8 blocks are definitely lost in loss record 36 of 36 ==11591== at 0x4C2ED48: malloc (vg_replace_malloc.c:298) ==11591== by 0x4C31363: realloc (vg_replace_malloc.c:826) ==11591== by 0x533D25C: re_compile_internal (in /usr/lib64/libc-2.27.so) ==11591== by 0x533DC3B: regcomp (in /usr/lib64/libc-2.27.so) ==11591== by 0x402BEB: parse_port_connection_data (sim_net.c:531) ==11591== by 0x403CBF: parse_port (sim_net.c:815) ==11591== by 0x403DF7: parse_ports (sim_net.c:842) ==11591== by 0x404021: parse_switch (sim_net.c:904) ==11591== by 0x4049CB: parse_netconf (sim_net.c:1111) ==11591== by 0x404F1F: read_netconf (sim_net.c:1166) ==11591== by 0x4126D4: sim_init_net (ibsim.c:523) ==11591== by 0x413445: main (ibsim.c:777) Signed-off-by: Honggang Li --- ibsim/sim_net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ibsim/sim_net.c b/ibsim/sim_net.c index bdce93a6ac10..068c38ef9f52 100644 --- a/ibsim/sim_net.c +++ b/ibsim/sim_net.c @@ -533,6 +533,7 @@ static int parse_port_connection_data(Port * port, int type, char *line) if (rc) { IBWARN("cannot parse remote lid and connection type"); + regfree(®ex); return 0; } @@ -542,18 +543,23 @@ static int parse_port_connection_data(Port * port, int type, char *line) /* expecting line with the following format: * [1] "H-000123456789ABCD"[2](123456789ABCE) # "description" lid 1 4xQDR ... */ - if (parse_port_link_width_and_speed(port, line_connection_type)) + if (parse_port_link_width_and_speed(port, line_connection_type)) { + regfree(®ex); return -1; + } } if (type == HCA_NODE) { /* expecting line with the following format: * [1](123456789ABCDE) "S-000123456789ABCDF"[2] # lid 2 lmc 0 "description" lid 1 4xQDR ... */ if (parse_port_lid_and_lmc(port, line) || - parse_port_link_width_and_speed(port, line_connection_type)) + parse_port_link_width_and_speed(port, line_connection_type)) { + regfree(®ex); return -1; + } } + regfree(®ex); return 0; }