diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-01-31 03:00:14 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-01-31 03:00:14 +0000 |
commit | 111281f1fc0b51a224755057e8a0791e395d184a (patch) | |
tree | 8329d95e89c40e21e66896ece89993b002bfdb14 /progs/util | |
parent | 663138a9510be5d2f3ee2bda41e3a8c86ab688b5 (diff) |
s/malloc/calloc/, fix mem leak
Diffstat (limited to 'progs/util')
-rw-r--r-- | progs/util/readtex.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 280d6c811d..37d5fcd0d3 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -97,7 +97,7 @@ static rawImageRec *RawImageOpen(const char *fileName) swapFlag = GL_FALSE; } - raw = (rawImageRec *)malloc(sizeof(rawImageRec)); + raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); if (raw == NULL) { fprintf(stderr, "Out of memory!\n"); return NULL; @@ -148,12 +148,15 @@ static rawImageRec *RawImageOpen(const char *fileName) static void RawImageClose(rawImageRec *raw) { - fclose(raw->file); free(raw->tmp); free(raw->tmpR); free(raw->tmpG); free(raw->tmpB); + if (raw->rowStart) + free(raw->rowStart); + if (raw->rowSize) + free(raw->rowSize); if (raw->sizeZ>3) { free(raw->tmpA); } |