Re: [ng-spice] Segmentation violation on running scripts
Hello,
I too have run into a segmentation fault similar to what Alan
describes. Perhaps it is the same one. In file variable.c,
function cp_setparse(), at roughly line 359, is a call to
tfree(),
tfree(ss);/*DG: cp_unquote Memory leak*/
This will eventually cause variable ss to be passed to free().
It is at this point that a segmentation violation can occur.
The call is located a few lines after a call to ft_numparse(),
td = ft_numparse(&ss, FALSE);
If I understand that function correctly, it can update the
value of variable ss. Unfortunately, trying to free ss is
what causes the segmentation violation. A fix would be to
keep a copy of the original value of ss before it is passed
to ft_numparse(), then pass that location to tfree() instead
of ss. (That is the fix that I have applied to my local copy.)
Is or will this fixed in a subsequent rework of NG Spice?
Thanks!
Bob
------------Included Message------------
From: "Gillespie, Alan" <Alan.Gillespie@analog.com>
To: "'ng-spice@ieee.ing.uniroma1.it'" <ng-spice@ieee.ing.uniroma1.it>
Date: Wed, 10 Jan 2001 11:05:47 -0000
Subject: RE: [ng-spice] Segmentation violation on running scripts
Is this a different seg fault from the one that has been
fixed since rework 13 ? As far as I remember, the file
variable.c had some fixes to stop some memory leaks, but
because of some side effects of other functions, it ended
up freeing pointers which had been moved from their
original malloced location.
Cheers,
Alan
----------End Included Message----------
Partial thread listing:
- Re: [ng-spice] Segmentation violation on running scripts, (continued)