projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
663138a
)
s/malloc/calloc/, fix mem leak
author
Brian Paul
<brian.paul@tungstengraphics.com>
Tue, 31 Jan 2006 03:00:14 +0000
(
03:00
+0000)
committer
Brian Paul
<brian.paul@tungstengraphics.com>
Tue, 31 Jan 2006 03:00:14 +0000
(
03:00
+0000)
progs/util/readtex.c
patch
|
blob
|
history
diff --git
a/progs/util/readtex.c
b/progs/util/readtex.c
index 280d6c811d91e69cb4bf2afcfa38b349afcc2021..37d5fcd0d3a83f94a9be3f4eee6fdd250ab899cb 100644
(file)
--- 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);
}