[ovs-dev] [PATCH] ovsdb: Fix memory leak in execute_update.

Ben Pfaff blp at ovn.org
Wed Jul 27 18:20:35 UTC 2016


On Wed, Jul 27, 2016 at 12:18:37PM +0800, nickcooper-zhangtonghao wrote:
> If the ‘ovsdb_condition_from_json’ return the error, cnd->clauses will be
> set NULL, so ‘ovsdb_condition_destroy’ should check the 'cnd->clauses’ before
> free it.

Please read CodingStyle.md:

    Functions that destroy an instance of a dynamically-allocated type
    should accept and ignore a null pointer argument.  Code that calls
    such a function (including the C standard library function free())
    should omit a null-pointer check.  We find that this usually makes
    code easier to read.



More information about the dev mailing list