bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #35192] Memory leak in NSException


From: Larry Campbell
Subject: [bug #35192] Memory leak in NSException
Date: Thu, 29 Dec 2011 17:53:09 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]