On Sat, Mar 30, 2002 at 01:31:09PM -0800, Kris Kennaway wrote:

Hi Terry and Kris,

> Sounds like it could be the malloc.conf defaults on -current exposing
> a bug in the program code.

Yes, there was a bug in my code, it just didn't show up on -STABLE.
Apparently, when one uses efence, allocated memory is zeroed, which
would explain why the program worked when linked with efence. I've
built a debug version of libdialog and found something interesting...

#0  0x28324253 in dialog_checklist (title=0x80bcf54 "Knobs Menu", 
prompt=0x80bcf60 "A checked entry means that knob is set to YES",
height=-1,width=-1, list_height=15,
cnt=-1697, it=0x81e6014, result=0x0) at checklist.c:82
82                  status[i] = ditems[i].checked ?
ditems[i].checked(&ditems[i]) : FALSE;

There is something odd in that cnt value, as there aren't 1697 entries
in the menu. The problem is the way the dialog structure is built, I
malloc memory but don't zero it, so when I call the function that in
the end calls dialog, it erroneously assumes that there are more entries
than there really are, since it simply checks for !=0 data. The garbage
present in the malloc'ed mem is the cause.

Why this problem doesn't show on -STABLE is still beyond my
comprehension, default malloc behaviour maybe?

Anyway, problem solved, thanks for all.

        Miguel Mendez - [EMAIL PROTECTED]
        GPG Public Key :: http://energyhq.homeip.net/files/pubkey.txt
        EnergyHQ :: http://www.energyhq.tk
        FreeBSD - The power to serve!

Attachment: msg36803/pgp00000.pgp
Description: PGP signature

Reply via email to