Re: [PATCH 1/1] Solves Bug 1462 - `nft -j list set` does not show counters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 6, 2020 at 7:15 PM Jose M. Guisado <guigom@xxxxxxxxxx> 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)



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux