未验证 提交 c689c2c6 编写于 作者: D David Lin 提交者: GitHub

Fixed a hidden stack overflow bug

'memset' should been next step after 'NULL' judge
上级 9d9432eb
......@@ -186,12 +186,13 @@ int fh_pwm_probe(void *priv_data)
PWM_Enable(pwm_obj, RT_FALSE);
pwm_dev = rt_malloc(sizeof(struct rt_device));
rt_memset(pwm_dev, 0, sizeof(struct rt_device));
if (pwm_dev == RT_NULL)
{
rt_kprintf("ERROR: %s rt_device malloc failed\n", __func__);
}
rt_memset(pwm_dev, 0, sizeof(struct rt_device));
pwm_dev->user_data = &pwm_drv;
pwm_dev->open =fh_pwm_open;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册