netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gopal Yadav <gopunop@gmail.com>
To: "Jose M. Guisado" <guigom@riseup.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/1] Solves Bug 1462 - `nft -j list set` does not show counters
Date: Wed, 7 Oct 2020 11:58:01 +0530	[thread overview]
Message-ID: <CAAUOv8gV4CZ9PZiRSkdg+acY1r7CPofpjUjZ72f6XdWfeiAd3w@mail.gmail.com> (raw)
In-Reply-To: <b9e9fb11-1bb4-065b-4e64-f10665820606@riseup.net>

On Tue, Oct 6, 2020 at 7:15 PM Jose M. Guisado <guigom@riseup.net> wrote:
>
> On 6/10/20 14:42, Gopal Yadav wrote:
> > Should I always run ASAN before submitting patches as a regular practice?
>
> I usually check for leaks when submitting patches, using either ASAN or
> Valgrind.
>
> > json_object_update_missing_new() was raising a warning so I have used
> > json_object_update_missing() in the updated patch.
>
> I've been unable to reproduce said warning when using
> json_object_update_missing_new.
>
> You need to use the *_new function, because it will call json_decref on
> tmp for you. If not the reference to tmp is leaked.

Since on using *_new() build fails, should I call json_decref(tmp)
explicitly after json_object_update_missing()?

I couldn't get ASAN to run, but I ran valgrind by doing `valgrind nft
list ruleset` on both versions, with & without json_decref(tmp). Both
of them produce the same output which says no leaks:

==5967== Memcheck, a memory error detector
==5967== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5967== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==5967== Command: nft list ruleset
==5967==
table inet dev {
    set ports_udp {
        type inet_service
        size 65536
        flags dynamic,timeout
        timeout 30d
        elements = { 53 expires 29d6h14m26s268ms counter packets 0 bytes 0 }
    }
}
==5967==
==5967== HEAP SUMMARY:
==5967==     in use at exit: 0 bytes in 0 blocks
==5967==   total heap usage: 78 allocs, 78 frees, 390,728 bytes allocated
==5967==
==5967== All heap blocks were freed -- no leaks are possible
==5967==
==5967== For counts of detected and suppressed errors, rerun with: -v
==5967== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

      reply	other threads:[~2020-10-07  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 12:58 [PATCH 1/1] Solves Bug 1462 - `nft -j list set` does not show counters Gopal Yadav
2020-10-06 10:33 ` Jose M. Guisado
2020-10-06 12:42   ` Gopal Yadav
2020-10-06 13:45     ` Jose M. Guisado
2020-10-07  6:28       ` Gopal Yadav [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAUOv8gV4CZ9PZiRSkdg+acY1r7CPofpjUjZ72f6XdWfeiAd3w@mail.gmail.com \
    --to=gopunop@gmail.com \
    --cc=guigom@riseup.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).