Commit 09a6d825 authored by rmagueta's avatar rmagueta

Avoid read null pointer file

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