From 52fbb3f734218ea7dbe60cbbf7a6628cb0c6bdc8 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 29 Jul 2009 14:46:47 -0700 Subject: [PATCH] Fix memory leak, unneeded argument. Very minor issues dosify was not closing files so memory leaks could show up and vpi/sys_readmem.c was passing the file after it was closed to the lexor cleanup code. The lexor cleanup code does not need an argument. --- dosify.c | 28 ++++------------------------ vpi/sys_readmem.c | 2 +- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/dosify.c b/dosify.c index 7a3245bde..77fa81be7 100644 --- a/dosify.c +++ b/dosify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 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: dosify.c,v 1.5 2003/07/15 16:17:47 steve Exp $" -#endif /* * This is a simple program to make a dosified copy of the @@ -51,6 +48,7 @@ int main(int argc, char*argv[]) ofile = fopen(argv[2], "wb"); if (ofile == 0) { fprintf(stderr, "Unable to open %s for output.\n", argv[2]); + fclose(ifile); return 2; } @@ -64,25 +62,7 @@ int main(int argc, char*argv[]) pr = ch; } + fclose(ifile); + fclose(ofile); return 0; } - -/* - * $Log: dosify.c,v $ - * Revision 1.5 2003/07/15 16:17:47 steve - * Fix spelling of ifdef. - * - * Revision 1.4 2003/07/15 03:49:22 steve - * Spelling fixes. - * - * Revision 1.3 2002/08/12 01:34:58 steve - * conditional ident string using autoconfig. - * - * Revision 1.2 2002/08/11 23:47:04 steve - * Add missing Log and Ident strings. - * - * Revision 1.1 2001/08/03 17:06:47 steve - * Add install of examples for Windows. - * - */ - diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index 9adc062b9..14976d253 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -401,7 +401,7 @@ static PLI_INT32 sys_readmem_calltf(PLI_BYTE8*name) free(value.value.vector); free(fname); fclose(file); - destroy_readmem_lexor(file); + destroy_readmem_lexor(); return 0; }