4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-22 22:29:12 +08:00

Merge pull request #3193 from wangk-ge/master

修改内存泄漏问题
This commit is contained in:
Bernard Xiong 2019-11-21 22:04:42 +08:00 committed by GitHub
commit 55c3182b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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); result = rt_device_register(device, device_name, flag | RT_DEVICE_FLAG_STANDALONE);
if (result != RT_EOK) if (result != RT_EOK)
{ {
rt_free(device_name);
LOG_E("rt_sensor register err code: %d", result); LOG_E("rt_sensor register err code: %d", result);
return result; return result;
} }
rt_free(device_name);
LOG_I("rt_sensor init success"); LOG_I("rt_sensor init success");
return RT_EOK; return RT_EOK;
} }