Skip to content

Commit 649f75f

Browse files
authored
修改内存泄漏问题
1 parent 35e035b commit 649f75f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

components/drivers/sensors/sensor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,12 @@ int rt_hw_sensor_register(rt_sensor_t sensor,
430430
result = rt_device_register(device, device_name, flag | RT_DEVICE_FLAG_STANDALONE);
431431
if (result != RT_EOK)
432432
{
433+
rt_free(device_name);
433434
LOG_E("rt_sensor register err code: %d", result);
434435
return result;
435436
}
436437

438+
rt_free(device_name);
437439
LOG_I("rt_sensor init success");
438440
return RT_EOK;
439441
}

0 commit comments

Comments
 (0)