Help with dbimp crash?

Joseph Pallas pallas@CS.Stanford.EDU
Mon Aug 28 15:59:00 GMT 2000

I've been encountering a crash in dbimp that seems to be due to a dangling
pointer, but I'm having trouble understanding how this stuff is supposed
to work.

I've narrowed the problem down to an entry in a hash table whose key is a
pointer that isn't valid.  At first I thought the pointer was getting
stomped on, but I started tracing things more thoroughly and discovered
that the entry didn't change, and the pointer was valid at the time the
entry was added. The memory that it pointed to, however, actually went
away sometime later.

The troublesome insertion occurs when the stack looks like this:


The value of item.key in HashTableAdd is a char pointer that was set to
sString.text in f_MacroFind.  This ultimately seems to be a pointer
derived from yytext in f_TokenInput.  Since yytext belongs to (f)lex,
expecting it to be stable and long-lived would be a mistake.

Could someone who actually understands this stuff tell me if I've got it
right?  If so, is it fixable?  I'm fairly petrified of trying a fix
without being sure of the problem and understanding how things are
supposed to work.  I really don't want to introduce a memory leak.


More information about the Sourcenav mailing list