mainThe oSIP library - Support: sr #106323, Memory leak upon realloc() failure

 
 

sr #106323: Memory leak upon realloc() failure

Submitter:  None
Submitted:  Fri 28 Mar 2008 05:41:59 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  4 - Important Status:  Done
Privacy:  Public Assigned to:  aymeric
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 03 Sep 2016 11:35:21 AM UTC, comment #1: 

(sorry for not processing in time)

Aymeric MOIZARD <aymeric>
Group administrator
Fri 28 Mar 2008 05:41:59 PM UTC, original submission:  

The man page of realloc on both Linux and Solaris stated that, "If the space cannot be allocated, the object shall remain unchanged."

Possible memory leaks in both oSIP 3.0.3 and 3.1.0:

1. File osipparser2/osip_message_to_str.c, function _osip_message_realloc(), the memory pointed to by input parameter *dest is lost if realloc() returns NULL. The leak is at least SIP_MESSAGE_MAX_LENGTH (4000 bytes).

2. File osipparser2/osip_message_to_str.c, all other 7 calls to osip_realloc() will cause similar leaks if realloc() failed and returns NULL, because the input memory block to realloc() is forgotten.

3. Most other references to osip_realloc() does not check the returned value (osip_uri.c, osip_via.c, osip_body.c, etc.)

An embedded application will not be able to recover when it briefly runs out of memory.  My suggestion is to provide a hook for osip_realloc() to terminate and the main application.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by aymeric (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-03 aymeric StatusNone Done
        Assigned toNone aymeric
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code