ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 3331] New: Remove checking for NULL before g_free()

Date: Fri, 13 Mar 2009 10:58:39 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3331

           Summary: Remove checking for NULL before g_free()
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Trivial
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: darkjames@xxxxxxxxxxxxxxxx



Jakub Zawadzki <darkjames@xxxxxxxxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2855|                            |review_for_checkin?
               Flag|                            |


Created an attachment (id=2855)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=2855)
Remove checking for NULL before g_free()

Build Information:

--
g_free() is NULL safe, so we don't need check against it.

Btw. glib *alloc()'s with len > 0, can't return NULL (on oom it aborts program)
however sometimes I can see in code:

 if ((bar = g_realloc(bar, foolen)) == NULL)
     return -1;

should it be replaced by simply: 
 bar = g_realloc(bar, foolen);
(when foolen > 0)

or by g_try_realloc()?

@ http://wiki.wireshark.org/KnownBugs/OutOfMemory
I see there's policy we should run as long as possibly when we got oom...


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.