icon-o-matic: Fix resource leak
When exception was thrown, resources allocated to 'fd' and 'p' weren't released. Fix PVS V773 Change-Id: I8a546cbbec4e5060b385cc11f0f33b63f61a0924 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2156 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
696d127d12
commit
b35395fef1
@ -335,6 +335,7 @@ Parser::parse(const char* pathToFile)
|
||||
FILE* fd = fopen(pathToFile, "r");
|
||||
if (fd == 0) {
|
||||
sprintf(msg, "Couldn't open file %s", pathToFile);
|
||||
XML_ParserFree(p);
|
||||
throw exception(msg);
|
||||
}
|
||||
|
||||
@ -346,6 +347,8 @@ Parser::parse(const char* pathToFile)
|
||||
sprintf(msg, "%s at line %ld\n",
|
||||
XML_ErrorString(XML_GetErrorCode(p)),
|
||||
XML_GetCurrentLineNumber(p));
|
||||
fclose(fd);
|
||||
XML_ParserFree(p);
|
||||
throw exception(msg);
|
||||
}
|
||||
} while (!done);
|
||||
|
Loading…
Reference in New Issue
Block a user