coverity scan CID 22487: dereference after null check

we don't use many differnt calendars, so this has never happened.
This commit is contained in:
Enno Rehling 2015-10-29 09:43:51 +01:00
parent e27c4b4164
commit 8b92003fff
1 changed files with 9 additions and 7 deletions

View File

@ -439,7 +439,6 @@ static int parse_calendar(xmlDocPtr doc)
for (i = 0; i != nsetMonths->nodeNr; ++i) {
xmlNodePtr month = nsetMonths->nodeTab[i];
xmlChar *propValue = xmlGetProp(month, BAD_CAST "name");
int j;
if (propValue) {
if (newyear
@ -451,14 +450,17 @@ static int parse_calendar(xmlDocPtr doc)
monthnames[i] = _strdup(mkname("calendar", (const char *)propValue));
xmlFree(propValue);
}
for (j = 0; j != seasons; ++j) {
xmlNodePtr season = month->parent;
if (season == nsetSeasons->nodeTab[j]) {
month_season[i] = j;
break;
if (nsetSeasons) {
int j;
for (j = 0; j != seasons; ++j) {
xmlNodePtr season = month->parent;
if (season == nsetSeasons->nodeTab[j]) {
month_season[i] = j;
break;
}
}
assert(j != seasons);
}
assert(j != seasons);
storms[i] = xml_ivalue(nsetMonths->nodeTab[i], "storm", 0);
}
}