Remove two memory leaks.

This patch removes two memory leaks. One in the driver and one
in the runtime.
This commit is contained in:
Cary R 2008-06-09 17:46:33 -07:00 committed by Stephen Williams
parent 6f61cf2e4e
commit 8439fc6c19
2 changed files with 14 additions and 16 deletions

View File

@ -266,6 +266,7 @@ static const char*my_tempfile(const char*str, FILE**fout)
*/
static int t_default(char*cmd, unsigned ncmd)
{
int rtn = 0;
unsigned rc;
#ifdef __MINGW32__
unsigned ncmd_start = ncmd;
@ -328,23 +329,24 @@ static int t_default(char*cmd, unsigned ncmd)
remove(compiled_defines_path);
}
#ifdef __MINGW32__ /* MinGW just returns the exit status, so return it! */
free(cmd);
return rc;
#else
if (rc != 0) {
if (rc == 127) {
fprintf(stderr, "Failed to execute: %s\n", cmd);
return 1;
}
if (WIFEXITED(rc))
return WEXITSTATUS(rc);
fprintf(stderr, "Command signaled: %s\n", cmd);
return -1;
rtn = 1;
} else if (WIFEXITED(rc)) {
rtn = WEXITSTATUS(rc);
} else {
fprintf(stderr, "Command signaled: %s\n", cmd);
rtn = -1;
}
}
return 0;
free(cmd);
return rtn;
#endif
}
@ -871,6 +873,7 @@ int main(int argc, char **argv)
}
fprintf(stderr, "Command signaled: %s\n", cmd);
free(cmd);
return -1;
}
@ -889,6 +892,4 @@ int main(int argc, char **argv)
fclose(iconfig_file);
return t_default(cmd, ncmd);
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_callback.cc,v 1.46 2007/04/10 04:32:05 steve Exp $"
#endif
/*
* Callbacks are objects that carry a function to be called when some
@ -108,6 +105,7 @@ void delete_vpi_callback(struct __vpiCallback* ref)
assert(ref);
assert(ref->base.vpi_type);
assert(ref->base.vpi_type->type_code == vpiCallback);
if (ref->cb_sync != 0) delete ref->cb_sync;
delete ref;
}
@ -626,4 +624,3 @@ void vvp_fun_signal_real::get_value(struct t_vpi_value*vp)
vp->format);
}
}