Re: [evolution-patches] gal, accessiblity, etable, handle the columns change (add/delete/reorder)



Larry Ewing wrote:

On Mon, 2003-12-01 at 10:29, Mike Kestner wrote:
On Mon, 2003-11-24 at 00:25, Yuedong Du wrote:

The patch fix bug 49594.
+static void
+eti_header_structure_changed (ETableHeader *eth, AtkObject *a11y)
+{
+
<snip>
+        /* Init to ETI_HEADER_UNCHANGED. */
+        state = g_malloc0 (sizeof (gint) * n_cols);
+        prev_state = g_malloc0 (sizeof (gint) * prev_n_cols);
+        reorder = g_malloc0 (sizeof (gint) * n_cols);
+	g_return_if_fail (state && reorder && prev_state);
This could possibly leak two of the three blocks, although if mallocs
are failing the wheels have already come off.  Also, typically gal uses
g_new0 instead of g_malloc0, but that's not a big deal.  If you really
want to guard against malloc failures, you should g_free state,
prev_state, and reorder before returning.


g_malloc* can never fail, they will allways abort with g_error if malloc
returns NULL, so testing the return value is pointless.  If you need
them glib provides allocators that can fail using the g_try_malloc*
functions.

--Larry

Because I do not benefit much from using guard on memory fail. Just utilize g_malloc()'s default
beheviour for fail. Remove the g_return_if_fail() testing.

Commited to HEAD.

York

_______________________________________________
Evolution-patches mailing list
Evolution-patches lists ximian com
http://lists.ximian.com/mailman/listinfo/evolution-patches





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]