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: NonePriority: 5 - Normal
Severity: 4 - ImportantStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to 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):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup