URL:
  <http://savannah.gnu.org/bugs/?35192>

                 Summary: Memory leak in NSException
                 Project: GNUstep
            Submitted by: lcampbel
            Submitted on: Thu 29 Dec 2011 05:53:08 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

In trunk, at NSException.m line 960, in this snippet:

====================
- (void) raise
{
 if (_reserved == 0)
   {
     _reserved = NSZoneCalloc([self zone], 2, sizeof(id));
   }
 _e_stack = [GSStackTrace new]; // leak
====================


If you're re-raising an exception, _e_stack is already populated, and so the
assignment clobbers the existing pointer and leaks it. I think the existing
stack trace should be preserved by changing the last line of the snippet to:

 if (_e_stack == nil)
   _e_stack = [GSStackTrace new];





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35192>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to