bug-ncurses
[Top][All Lists]
Advanced

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

TERMTYPE.term_names allocation confusion in ncurses-5.2-20001021


From: Tom Riddle
Subject: TERMTYPE.term_names allocation confusion in ncurses-5.2-20001021
Date: Wed, 10 Jan 2001 16:06:41 -0500

All,

It seems that TERMTYPE.term_names is a bit confused as to it's home:


in _nc_parse_entry():

entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr);

which allocates in str_table.


in read_termtype():

ptr->term_names = typeCalloc(char, strlen(buf) + 1);


in _nc_free_termtype():
    FreeIfNeeded(ptr->str_table);
    FreeIfNeeded(ptr->term_names);

which causes free() to be called twice with that same argument when 
str_table == term_names, or free() being called with an argument 
that was never malloc'ed.


My solution is to always allocate new storage for term_names, as in 
read_termtype().  See attached patch.

I am not subscribed to the list, so please respond to me directly.

Tom

-- 

Tom Riddle

Oracom, Inc.
http://www.oracom.com

Tel. +1 978.557.5710x305
Fax  +1 978.557.5716

Attachment: term_names_fix.patch
Description: Binary data


reply via email to

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