Skip to content

Commit

Permalink
db-ctl-base: Fix memory leak of db commands.
Browse files Browse the repository at this point in the history
Variable "want_key" in function check_condition and variable "key"
in function set_column were not destroyed in exception branch.

This patch calls ovsdb_atom_destroy to release resources to avoid
memory leak.

Fixes: 79c1a00 ("db-ctl-base: Don't die in set_column() on error.")
Fixes: e09b3af ("db-ctl-base: Don't die in is_condition_satisfied() on error")
Acked-by: Simon Horman <[email protected]>
Signed-off-by: Zengyuan Wang <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
Zengyuan Wang authored and igsilya committed Oct 18, 2023
1 parent c29ba54 commit 23a70e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/db-ctl-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ check_condition(const struct ovsdb_idl_table_class *table,
type.value.type = OVSDB_TYPE_VOID;
error = ovsdb_datum_from_string(&b, &type, value_string, symtab);
if (error) {
ovsdb_atom_destroy(&want_key, column->type.key.type);
goto out;
}

Expand Down Expand Up @@ -1374,6 +1375,7 @@ set_column(const struct ovsdb_idl_table_class *table,
error = ovsdb_atom_from_string(&value, NULL, &column->type.value,
value_string, symtab);
if (error) {
ovsdb_atom_destroy(&key, column->type.key.type);
goto out;
}

Expand Down

0 comments on commit 23a70e2

Please sign in to comment.