修改内存泄漏问题

This commit is contained in:
wangk-ge 2019-11-11 16:46:43 +08:00 committed by GitHub
parent 35e035b8b1
commit 649f75f861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -430,10 +430,12 @@ int rt_hw_sensor_register(rt_sensor_t sensor,
result = rt_device_register(device, device_name, flag | RT_DEVICE_FLAG_STANDALONE);
if (result != RT_EOK)
{
rt_free(device_name);
LOG_E("rt_sensor register err code: %d", result);
return result;
}
rt_free(device_name);
LOG_I("rt_sensor init success");
return RT_EOK;
}