Skip to content

Commit 708c83f

Browse files
chumakdigsilya
authored andcommitted
ovs-router: Fix JSON object leak in ovs/router/rule/show command.
There is a memory leak when listing router rules in JSON format when a rule doesn't match the requested address family. Coverity report: CID 556928: Resource leaks (RESOURCE_LEAK) Variable "entry" going out of scope leaks the storage it points to. Fixes: 5c30756 ("ovs-router: Introduce ovs/route/rule/show command.") Signed-off-by: Dima Chumak <[email protected]> Signed-off-by: Ilya Maximets <[email protected]>
1 parent 3200111 commit 708c83f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/ovs-router.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,12 @@ ovs_router_rules_show_json(struct json *rule_entries, bool ipv6)
855855
struct ds ds;
856856

857857
PVECTOR_FOR_EACH (rule, &rules) {
858-
struct json *entry = json_object_create();
858+
struct json *entry;
859859

860860
if (rule->ipv4 == ipv6) {
861861
continue;
862862
}
863+
entry = json_object_create();
863864

864865
json_object_put(entry, "priority", json_integer_create(rule->prio));
865866
json_object_put(entry, "user", json_integer_create(rule->user));

0 commit comments

Comments
 (0)