Don't print a string after possibly freeing it.
new= newvar(name) takes ownership of the string and might free its memory. Don't print name. Do print new->v_name. Also #include <string.h> for strcmp().
This commit is contained in:
parent
65278bc9a9
commit
e617f42503
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ack.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
|
@ -81,7 +82,7 @@ void setsvar(char *name, char *str) {
|
|||
|
||||
new= newvar(name);
|
||||
#ifdef DEBUG
|
||||
if ( debug>=2 ) vprint("%s=%s\n", name, str) ;
|
||||
if ( debug>=2 ) vprint("%s=%s\n", new->v_name, str) ;
|
||||
#endif
|
||||
new->v_type= string;
|
||||
new->v_value.v_string= str;
|
||||
|
@ -92,7 +93,7 @@ void setpvar(char *name, char *(*rout)(void)) {
|
|||
|
||||
new= newvar(name);
|
||||
#ifdef DEBUG
|
||||
if ( debug>=2 ) vprint("%s= (*%o)()\n",name,rout) ;
|
||||
if ( debug>=2 ) vprint("%s= (*%o)()\n", new->v_name, rout) ;
|
||||
#endif
|
||||
new->v_type= routine;
|
||||
new->v_value.v_routine= rout;
|
||||
|
|
Loading…
Reference in a new issue