static char *
virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
{
- char *cur, *eol;
+ char *cur, *eol = NULL;
if ((cur = strstr(base, "Vendor: ")) != NULL) {
cur += 8;
goto no_memory;
}
- return eol + 1;
+ return eol ? eol + 1 : NULL;
no_memory:
return NULL;
static char *
virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
{
- char *cur, *eol;
+ char *cur, *eol = NULL;
if ((base = strstr(base, "System Information")) == NULL)
return 0;
goto no_memory;
}
- return eol + 1;
+ return eol ? eol + 1 : NULL;
no_memory:
return NULL;
while((tmp_base = strstr(base, "Processor Information")) != NULL) {
base = tmp_base;
+ eol = NULL;
if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) {
goto no_memory;
goto no_memory;
}
+ if (!eol)
+ break;
base = eol + 1;
}
while ((tmp_base = strstr(base, "Memory Device")) != NULL) {
base = tmp_base;
+ eol = NULL;
if (VIR_EXPAND_N(ret->memory, ret->nmemory, 1) < 0) {
goto no_memory;
}
next:
+ if (!eol)
+ break;
base = eol + 1;
}