buglibiconv - Bugs: bug #36781, Resource leak in...

 
 

bug #36781: Resource leak in libcharset/lib/localcharset.c

Submitted by:  Sarat Addepalli <sarataddepalli>
Submitted on:  Wed 04 Jul 2012 12:42:11 PM UTC  
 
Category: OtherSeverity: 3 - Normal
Item Group: NoneStatus: Wont Fix
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 23 Nov 2016 11:35:00 PM UTC, comment #2:

Duplicated by bug #39489.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Sun 08 Jul 2012 04:56:00 PM UTC, comment #1:

Thanks for the suggestion. If relocate() returns a freshly
allocated string, it is indeed not freed here.

But the severity is low, because the code inside
get_charset_aliases is only executed once (or, in the worst case,
as many times as there are threads that call get_charset_aliases
at the same time).

Your code is not correct, since in the case when the environment
variable CHARSETALIASDIR is set, it would call free() on a
part of 'environ', which is not allowed. This could be worked
around by introducing another local variable. But I don't think
these complications are worth it.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Wed 04 Jul 2012 12:42:11 PM UTC, original submission:

Detected resource leak in "libcharset/lib/localcharset.c". In the function get_charset_aliases(), the variable dir is possibly allocated memory from the heap (by the function call dir = relocate(LIBDIR)), but is not freed. Since relocate() possibly assigns LIBDIR to dir (in case no relocation is required), we will need to check that dir is not LIBDIR before freeing it.

Please check the attached patch file.
Application of this generates no warnings with gcc -Wall.

Sarat Addepalli <sarataddepalli>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #26148:  localcharset.patch added by sarataddepalli (457B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Posted a comment)
  • -unavailable- added by sarataddepalli (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):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 24 Nov 2016 12:38:45 AM UTChaibleCategoryNone=>Other
    Sun 08 Jul 2012 04:56:00 PM UTChaibleStatusNone=>Wont Fix
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed
    Wed 04 Jul 2012 12:42:11 PM UTCsarataddepalliAttached File-=>Added localcharset.patch, #26148

    Back to the top


    Powered by Savane 3.1-cleanup1