bug-ncurses
[Top][All Lists]
Advanced

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

Re: any idea what might be wrong with this code?...


From: Thomas Dickey
Subject: Re: any idea what might be wrong with this code?...
Date: Tue, 10 Jul 2007 16:39:15 -0400 (EDT)

On Tue, 10 Jul 2007, Bryan Christ wrote:

items=menu_items(menu);
if(items==NULL) return;

count=item_count(menu);
if(count==ERR || count==0) return;

if(free_menu(menu)==E_OK)
{
        for(i=0;i<count;i++)
        {
                text=(gchar*)item_name(items[i]);
                if(text!=NULL) g_free(text);      /* misbehaving line */
                free_item(items[i])               /* also misbehaving */
        }
}

just to mention up front, all of the names and descriptions associated with the ITEM were allocated with g_strdup()

I don't see the problem (the fragment looks close enough to the example
in test/ncurses.c).

according to strace() i am trying to free an invalid pointer.

valgrind helps...

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]