Plug memory leaks when running out of memory.
Reported by: clang scan-build MFC after: 2 weeks
This commit is contained in:
parent
e5562eb934
commit
ef9fc4afd4
@ -275,15 +275,17 @@ EndElement(void *userData, const char *name)
|
||||
XML_StopParser(mt->parser, 0);
|
||||
warn("Cannot allocate memory during processing of '%s' "
|
||||
"element", name);
|
||||
free(p);
|
||||
return;
|
||||
}
|
||||
gc->lg_name = strdup(name);
|
||||
if (gc->lg_name == NULL) {
|
||||
free(gc);
|
||||
mt->error = errno;
|
||||
XML_StopParser(mt->parser, 0);
|
||||
warn("Cannot allocate memory during processing of '%s' "
|
||||
"element", name);
|
||||
free(gc);
|
||||
free(p);
|
||||
return;
|
||||
}
|
||||
gc->lg_val = p;
|
||||
|
Loading…
Reference in New Issue
Block a user