From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91E83A00C2; Sat, 25 Apr 2020 18:27:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F9E41C06D; Sat, 25 Apr 2020 18:27:13 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id E54151C020 for ; Sat, 25 Apr 2020 18:27:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587832031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lG6vnUxDl4cSOur7igvRuFxzeVj59S/okSIM8sOIquU=; b=dFydnUB/f9EulwtnxAeiGa4vGlrANdg47NbFFkeZJqJ0fO42b6CaHXlzyE7KOarNyh9Fxo iICD3zuXq01s5yNbW+2QPBhUt+Q2m4Mir40FUUkrAiN71GKNTy6Ogs4BfrgX55XZj56gvz Rj29NMmr+RYx/Xd2OCEw3JW5c0BiDI0= Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-7hhv9vFvNmeynrJVEgwb1A-1; Sat, 25 Apr 2020 12:27:09 -0400 X-MC-Unique: 7hhv9vFvNmeynrJVEgwb1A-1 Received: by mail-ua1-f69.google.com with SMTP id l9so6976784uao.12 for ; Sat, 25 Apr 2020 09:27:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+cjCx+rS5gPf5BdShPCVfoc0htbIS7rEie7ZmHA8L+E=; b=DEkuTnvckEbwTBZrKUAizbTlAcgM9WmCdbFX0YiItThsfYESbxjs7A0xfCzUUnNLAf NHeb8qN6CrTrop7NvyxM8NtC+jJOuvIXzOH3uqYwol+4CaUkjic/a/VU/VSTNA3iPGct 5ZicXlSJoPU+XbP0i8gI9K6VwWH/Q0Idsof+WRph764rN7EccGx2uWbtdee3B0NzOTHd 5u+OxeASqONYNwNswcJPvJpDCMML05fsELPkRDwyXBFkcTv5z3HYUVv5pT6BPXlm0unJ rOPoLu7MHM56Zg61ghA+JrWiUJf45/9PeR/rRyCDl4uAI82GbkZ33X7xIaGZt/HeGAY0 Wd3A== X-Gm-Message-State: AGi0PuawWNrK/ET36oTEX28GOiv9orqenIfpgX8+242HPshvvin8+/QU X67H3pTgtwAZaMH6SRm+BX/tUcZjSAbfNNwP2nESoDJOGl12yavUzXdnxa6xzJ5/niFpxmfXW55 Z8VgwiNjkUyzT5wHw1bU= X-Received: by 2002:a67:d817:: with SMTP id e23mr7601293vsj.39.1587832028446; Sat, 25 Apr 2020 09:27:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJI+1VACiO0YTssFsuR8al92w/HBoLws/YPcUUcCurGf8S8u2XRLk11n7RPV78xZVcgGC2IcN6FZN3qcoaZxQg= X-Received: by 2002:a67:d817:: with SMTP id e23mr7601278vsj.39.1587832028144; Sat, 25 Apr 2020 09:27:08 -0700 (PDT) MIME-Version: 1.0 References: <20200104013341.19809-1-stephen@networkplumber.org> <20200104013341.19809-3-stephen@networkplumber.org> In-Reply-To: <20200104013341.19809-3-stephen@networkplumber.org> From: David Marchand Date: Sat, 25 Apr 2020 18:26:57 +0200 Message-ID: To: Stephen Hemminger Cc: dev , Olivier Matz X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH 02/14] eal: log: free dynamic state on cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, Jan 4, 2020 at 2:34 AM Stephen Hemminger wrote: > > When rte_eal_cleanup is called, free all the memory > associated with dynamic log levels and types. > > Fixes: c1b5fa94a46f ("eal: support dynamic log types") > Cc: olivier.matz@6wind.com > Signed-off-by: Stephen Hemminger > --- > lib/librte_eal/common/eal_common_log.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/comm= on/eal_common_log.c > index 64d6e20947ed..7583bdc57619 100644 > --- a/lib/librte_eal/common/eal_common_log.c > +++ b/lib/librte_eal/common/eal_common_log.c > @@ -470,8 +471,23 @@ eal_log_set_default(FILE *default_log) > void > eal_log_cleanup(void) > { > + struct rte_eal_opt_loglevel *opt_ll, *tmp; > + size_t i; > + > if (default_log_stream) { > fclose(default_log_stream); > default_log_stream =3D NULL; > } > + > + TAILQ_FOREACH_SAFE(opt_ll, &opt_loglevel_list, next, tmp) { > + free(opt_ll->pattern); In regexp case, we have a leak on the regexp buffer. Fixed with: + if (opt_ll->pattern !=3D NULL) + free(opt_ll->pattern); + else + regfree(&opt_ll->re_match); > + free(opt_ll); > + } > + > + for (i =3D 0; i < rte_logs.dynamic_types_len; i++) > + free(rte_logs.dynamic_types[i].name); > + > + rte_logs.dynamic_types_len =3D 0; > + free(rte_logs.dynamic_types); > + rte_logs.dynamic_types =3D NULL; > } > -- > 2.20.1 > --=20 David Marchand