Message ID | 1469582910-64371-1-git-send-email-u9012063@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
On Tue, Jul 26, 2016 at 6:28 PM, William Tu <u9012063@gmail.com> wrote: > Valgrind testcase 1804 ovsdb-server.at:1023 insert rows, update rows by > value > reports the following leak. > json_from_string (json.c:1025) > execute_update (replication.c:614), similarily at execute_delete() > process_table_update (replication.c:502) > process_notification.part.5 (replication.c:445) > process_notification (replication.c:402) > check_for_notifications (replication.c:418) > replication_run (replication.c:110) > > Signed-off-by: William Tu <u9012063@gmail.com> > Tested, it removed the memory leak reported. I think declare 'where' as 'struct json' instead of 'const struct json' will make the code easier to read. Acked-by: Andy Zhou <azhou@ovn.org> >
On Tue, Jul 26, 2016 at 06:28:30PM -0700, William Tu wrote: > Valgrind testcase 1804 ovsdb-server.at:1023 insert rows, update rows by value > reports the following leak. > json_from_string (json.c:1025) > execute_update (replication.c:614), similarily at execute_delete() > process_table_update (replication.c:502) > process_notification.part.5 (replication.c:445) > process_notification (replication.c:402) > check_for_notifications (replication.c:418) > replication_run (replication.c:110) > > Signed-off-by: William Tu <u9012063@gmail.com> > --- > ovsdb/replication.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/ovsdb/replication.c b/ovsdb/replication.c > index af7ae5c..fe89d39 100644 > --- a/ovsdb/replication.c > +++ b/ovsdb/replication.c > @@ -573,6 +573,8 @@ execute_delete(struct ovsdb_txn *txn, const char *uuid, > } > > ovsdb_condition_destroy(&condition); > + json_destroy(CONST_CAST(struct json *, where)); > + > return error; > } > > @@ -630,6 +632,7 @@ execute_update(struct ovsdb_txn *txn, const char *uuid, > ovsdb_row_destroy(row); > ovsdb_column_set_destroy(&columns); > ovsdb_condition_destroy(&condition); > + json_destroy(CONST_CAST(struct json *, where)); > > return error; > } Thanks, good catch. I think that we should just remove "const" from the variable declarations in each case; the cast is not worth it.
On Mon, Aug 1, 2016 at 10:08 AM, William Tu <u9012063@gmail.com> wrote: > Thanks, I've submitted v2 which removes the 'const'. > LGTM. Pushed to master. Thanks for working on this. > >
diff --git a/ovsdb/replication.c b/ovsdb/replication.c index af7ae5c..fe89d39 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -573,6 +573,8 @@ execute_delete(struct ovsdb_txn *txn, const char *uuid, } ovsdb_condition_destroy(&condition); + json_destroy(CONST_CAST(struct json *, where)); + return error; } @@ -630,6 +632,7 @@ execute_update(struct ovsdb_txn *txn, const char *uuid, ovsdb_row_destroy(row); ovsdb_column_set_destroy(&columns); ovsdb_condition_destroy(&condition); + json_destroy(CONST_CAST(struct json *, where)); return error; }
Valgrind testcase 1804 ovsdb-server.at:1023 insert rows, update rows by value reports the following leak. json_from_string (json.c:1025) execute_update (replication.c:614), similarily at execute_delete() process_table_update (replication.c:502) process_notification.part.5 (replication.c:445) process_notification (replication.c:402) check_for_notifications (replication.c:418) replication_run (replication.c:110) Signed-off-by: William Tu <u9012063@gmail.com> --- ovsdb/replication.c | 3 +++ 1 file changed, 3 insertions(+)