Message ID | 20200818012424.8174-1-515672508@qq.com |
---|---|
State | New |
Headers | show |
Series | scr:Set property mode failed,memory leak | expand |
diff --git a/src/adapter.c b/src/adapter.c index 5e896a9f0..3d07921a7 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2917,9 +2917,10 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting, data->id = id; if (mgmt_send(adapter->mgmt, opcode, adapter->dev_id, len, param, - property_set_mode_complete, data, g_free) > 0) + property_set_mode_complete, data, g_free) > 0) { + g_free(data); return; - + } In the original code,if mgmt_send fails then 0 is returned,then this function return directly,do not free data. Therefore, you need to free data before executing return.