[svn:parrot] r43057 - branches/pmc_freeze_cleanup/src

darbelo at svn.parrot.org darbelo at svn.parrot.org
Tue Dec 15 00:17:02 UTC 2009


Author: darbelo
Date: Tue Dec 15 00:16:57 2009
New Revision: 43057
URL: https://trac.parrot.org/parrot/changeset/43057

Log:
Avoid leaks on exceptions.

Modified:
   branches/pmc_freeze_cleanup/src/pmc_freeze.c

Modified: branches/pmc_freeze_cleanup/src/pmc_freeze.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc_freeze.c	Mon Dec 14 22:45:53 2009	(r43056)
+++ branches/pmc_freeze_cleanup/src/pmc_freeze.c	Tue Dec 15 00:16:57 2009	(r43057)
@@ -514,6 +514,7 @@
     }
     else {
         if (Parrot_str_byte_length(interp, input) < header_length) {
+            PackFile_destroy(interp, pf);
             Parrot_ex_throw_from_c_args(interp, NULL,
                 EXCEPTION_INVALID_STRING_REPRESENTATION,
                 "bad string to thaw");
@@ -521,11 +522,13 @@
 
         /* TT #749: use the validation logic from Packfile_unpack */
         if (pf->header->bc_major != PARROT_PBC_MAJOR
-        ||  pf->header->bc_minor != PARROT_PBC_MINOR)
+        ||  pf->header->bc_minor != PARROT_PBC_MINOR) {
+            PackFile_destroy(interp, pf);
             Parrot_ex_throw_from_c_args(interp, NULL,
                     EXCEPTION_INVALID_STRING_REPRESENTATION,
                     "can't thaw a PMC from Parrot %d.%d", pf->header->bc_major,
                     pf->header->bc_minor);
+        }
 
         info->buffer = (Buffer *)input;
         PARROT_ASSERT(input->_bufstart == input->strstart);


More information about the parrot-commits mailing list