From 5929b97f708952c6bf22ccca094aa3cee27a64e4 Mon Sep 17 00:00:00 2001 From: allen Date: Thu, 21 Sep 2000 09:02:47 +0000 Subject: Fixed big memory leak, I think there's still something left though. git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@12 eff87b29-5268-4891-90a3-a07138403961 --- src/DumpVar.c | 6 ++++++ src/Write2D.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/DumpVar.c b/src/DumpVar.c index 96613da..8ebee86 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -104,6 +104,11 @@ int IOJpeg_DumpVar (cGH *GH, int index, int timelevel, IOJpegGeo_t *geo, FILE *f if (data) free (data); + if (hsize) + { + free (hsize); + } + return (0); } @@ -150,6 +155,7 @@ int IOJpeg_Output(cGH *GH, int index, int timelevel, CCTK_REAL *data, colormap_quality, fid); + free(dataout); return(1); } diff --git a/src/Write2D.c b/src/Write2D.c index 0eb0970..6260c89 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -62,11 +62,13 @@ int IOJpeg_Write2D (cGH *GH, int index, const char *alias) /* see if output file for this alias name was already created */ fdset_2D = (FILE **) GetNamedData (ssGH->fileList_2D, alias); - /* if (fdset_2D == NULL) */ { char *fname; - - fdset_2D = (FILE **) malloc (max_slabs * sizeof (FILE *)); + + if (!fdset_2D) + { + fdset_2D = (FILE **) malloc (max_slabs * sizeof (FILE *)); + } fname = (char *) malloc ((strlen (ssGH->outdir2D) + strlen (alias) + 20)*sizeof(char)); -- cgit v1.2.3