bug fixes
Hi,
The attached patch fixes two segfaults bugs. The first was a segfault on
startup bug, atoi doesn't seem to like null pointers. The second segfault
occured if an error happened during subckt expansion.
Patch against CVS is attached.
--
Daniel Bertrand
Index: frontend/inp.c
===================================================================
RCS file: /var/services/cvsroot/ngspice/ng-spice-rework/src/frontend/inp.c,v
retrieving revision 1.7
diff -u -r1.7 inp.c
--- frontend/inp.c 2001/06/05 18:00:28 1.7
+++ frontend/inp.c 2001/10/29 01:57:47
@@ -438,7 +438,12 @@
* the case before we do this but after we deal with the
* commands. */
if (!cp_getvar("nosubckt", VT_BOOL, (char *) &nosubckts))
- deck->li_next = inp_subcktexpand(deck->li_next);
+ if((deck->li_next = inp_subcktexpand(deck->li_next)) == NULL){
+ line_free(realdeck,TRUE);
+ line_free(deck->li_actual, TRUE);
+ return;
+ }
+
line_free(deck->li_actual,FALSE); /* SJB - free memory used by
old li_actual (if any) */
deck->li_actual = realdeck;
inp_dodeck(deck, tt, wl_first, FALSE, options, filename);
Index: misc/ivars.c
===================================================================
RCS file: /var/services/cvsroot/ngspice/ng-spice-rework/src/misc/ivars.c,v
retrieving revision 1.3
diff -u -r1.3 ivars.c
--- misc/ivars.c 2001/04/16 09:58:25 1.3
+++ misc/ivars.c 2001/10/29 01:57:47
@@ -80,9 +80,10 @@
env_overr(&Bug_Addr, "SPICE_BUGADDR");
env_overr(&Def_Editor, "SPICE_EDITOR");
env_overr(&temp, "SPICE_ASCIIRAWFILE");
-
- AsciiRawFile = atoi(temp);
-
+
+ if(temp)
+ AsciiRawFile = atoi(temp);
+
}
void
Partial thread listing: