[prog] curses forms free_field

ed orphan millward at Ms.UManitoba.CA
Thu May 13 16:25:46 EST 2004


I'm writing a small in Linux using
curses forms for input.  When I'm
finished with the input fields and
try to free them, I get a segmentation error.
This happens after the first field has
been freed.
eg.    unpost_form( my_form );
        free_form( my_form);
        for(i=0; i<MAXFIELDS; i++)
               free_field( field[  i ] );
    segmentation error happens here.
It never gets to the next statement,
          endwin();
Fields 0 to 31 are used for data input.
The last field, 32, is always set to NULL;
MAXFIELDS is set to 32  ( 0 - 31 )
I'm using the example in
Chapter 18 Forms Library of
NCURSES Programming Howto  at
http://www.cise.ufl.edu/~ppadala/ncurses/NCURSES_HOWTO/
   If I skip using  free_field completely, the
segmentation error goes away. But won't that
leave a memory leak ?
    Any information would be most welcome!




More information about the Programming mailing list