Commit 28b51909 authored by rmagueta's avatar rmagueta

Avoid read null pointer file

parent 311b5cc0
......@@ -101,10 +101,13 @@ static int baseRunTimeCommand(char* cmd) {
size_t retSize = 0;
fp = popen(cmd, "r");
memset(cmd, 1, sizeof(*cmd));
retSize = fread(cmd, 1, sizeof(*cmd), fp);
fclose(fp);
if(fp) {
memset(cmd, 1, sizeof(*cmd));
retSize = fread(cmd, 1, sizeof(*cmd), fp);
fclose(fp);
} else {
LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd);
}
if (retSize == 0) {
return 0;
......
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