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

William Tu u9012063 at gmail.com
Mon Aug 1 17:08:15 UTC 2016


Thanks, I've submitted v2 which removes the 'const'.


On Wed, Jul 27, 2016 at 1:39 PM, Ben Pfaff <blp at ovn.org> wrote:
> 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 at 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.



More information about the dev mailing list