Permalink
Browse files

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.
  • Loading branch information...
1 parent 11812d8 commit 52fbb3f734218ea7dbe60cbbf7a6628cb0c6bdc8 @caryr caryr committed with Jul 29, 2009
Showing with 5 additions and 25 deletions.
  1. +4 −24 dosify.c
  2. +1 −1 vpi/sys_readmem.c
View
28 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.
- *
- */
-
View
2 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;
}

0 comments on commit 52fbb3f

Please sign in to comment.