Wireshark-dev: [Wireshark-dev] Label leakage in epan/wslua/wslua_gui.c in error path ...
From: Richard Sharpe <[email protected]>
Date: Sat, 14 Jul 2012 07:15:54 -0700
Hi folks,

In epan/wslua/wslua_gui.c, we see this:

    for (i = 1; i <= top; i++) {
        gchar* label = (void*)luaL_checkstring(L,i);

        /* XXX leaks labels on error */
        if (! label)
            WSLUA_ERROR(new_dialog,"All fields must be strings");

        g_ptr_array_add(labels,label);
    }

The obvious solution would seem to be:

    for (i = 1; i <= top; i++) {
        gchar* label = (void*)luaL_checkstring(L,i);

        /* no more leaks of labels on error */
        if (! label) {
            g_ptr_array_free(labels, FALSE);
            WSLUA_ERROR(new_dialog,"All fields must be strings");
        }

        g_ptr_array_add(labels,label);
    }


-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)