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


sr #106323: Memory leak upon realloc() failure

Submitted by:  None
Submitted on:  Fri 28 Mar 2008 05:41:59 PM UTC  
Category:  None Priority:  5 - Normal
Severity:  4 - Important Status:  Done
Privacy:  Public Assigned to:  Aymeric MOIZARD <aymeric>
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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

(sorry for not processing in time)

Aymeric MOIZARD <aymeric>
Project AdministratorIn charge of this item.
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.



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

Attach Files:

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)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Sat 03 Sep 2016 11:35:21 AM UTC aymeric StatusNone => Done
        Assigned toNone => aymeric
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3