Commit 9b8d2bab authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

irq-demo: Check FILE pointer before operating with it

parent 2b7ec587
......@@ -47,8 +47,10 @@ static void send_to_file_log_device(log_device dev, const char *msg)
if(!check_file_log_priv(dev)) {
priv = get_private_info(dev);
fputs(msg, priv->fp);
fputs("\n", priv->fp);
if(priv && priv->fp) {
fputs(msg, priv->fp);
fputs("\n", priv->fp);
}
}
}
......@@ -56,10 +58,14 @@ static void deinit_file_log_device(log_device dev)
{
struct file_log_private *priv;
if(dev->private) {
if(!check_file_log_priv(dev)) {
priv = get_private_info(dev);
fclose(priv->fp);
free(dev->private);
if(priv) {
if(priv->fp) {
fclose(priv->fp);
}
free(priv);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment