From Murai Takashi <tmurai01@xxxxxxxxx>:
Murai Takashi has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2156 ;)
Change subject: icon-o-matic: Fix resource leak
......................................................................
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
---
M src/apps/icon-o-matic/import_export/svg/SVGParser.cpp
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/56/2156/1
diff --git a/src/apps/icon-o-matic/import_export/svg/SVGParser.cpp
b/src/apps/icon-o-matic/import_export/svg/SVGParser.cpp
index d640d7e..fcd182d 100644
--- a/src/apps/icon-o-matic/import_export/svg/SVGParser.cpp
+++ b/src/apps/icon-o-matic/import_export/svg/SVGParser.cpp
@@ -335,6 +335,7 @@
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 @@
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);
--
To view, visit https://review.haiku-os.org/c/haiku/+/2156
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I8a546cbbec4e5060b385cc11f0f33b63f61a0924
Gerrit-Change-Number: 2156
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange