[haiku-commits] haiku: hrev53771 - src/apps/icon-o-matic/import_export/svg

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 25 Jan 2020 09:18:42 -0500 (EST)

hrev53771 adds 1 changeset to branch 'master'
old head: 696d127d121b4b519e4dc32213b62ae1ba920df6
new head: b35395fef15badf9a3788243e7ea0be388423f09
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b35395fef15b+%5E696d127d121b

----------------------------------------------------------------------------

b35395fef15b: 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@xxxxxxxxx>

                                      [ Murai Takashi <tmurai01@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53771
Commit:      b35395fef15badf9a3788243e7ea0be388423f09
URL:         https://git.haiku-os.org/haiku/commit/?id=b35395fef15b
Author:      Murai Takashi <tmurai01@xxxxxxxxx>
Date:        Fri Jan 24 11:26:23 2020 UTC
Committer:   Stephan Aßmus <superstippi@xxxxxx>
Commit-Date: Sat Jan 25 14:18:39 2020 UTC

----------------------------------------------------------------------------

1 file changed, 3 insertions(+)
src/apps/icon-o-matic/import_export/svg/SVGParser.cpp | 3 +++

----------------------------------------------------------------------------

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 d640d7e157..fcd182d472 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 @@ 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);


Other related posts:

  • » [haiku-commits] haiku: hrev53771 - src/apps/icon-o-matic/import_export/svg - Stephan Aßmus