Use g_try_malloc() instead of g_malloc()

Bug #503086 reported by Aleksander Morgado
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
El Jardin
Fix Released
Medium
Aleksander Morgado

Bug Description

g_malloc() and g_malloc0() are used everywhere, and in the code, return value of the functions is always checked against NULL. The problem is that those functions will never return NULL: if no memory is available for allocation, they call g_error() internally and thus, SIGABRT.

Use g_try_malloc() and g_try_malloc0() instead, which will return NULL if memory allocation fails, and will not abort the execution of the program.

Changed in eljardin:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Aleksander Morgado (aleksander-m) wrote :

Fixed in trunk.

Changed in eljardin:
status: Confirmed → Fix Committed
assignee: nobody → Aleksander Morgado (aleksander-m)
milestone: none → 2.0.2005
Changed in eljardin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.