diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-10-19 00:49:29 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-10-19 00:49:29 +0000 |
commit | 95895823f75108cbfed2697498e4e097f493b236 (patch) | |
tree | 77efe89b445f168b7d0c63f3fd5f0a23f6e743e8 /libdimension/texture.c | |
parent | 8710689500d3d35d04aabd727f12698590a816cb (diff) | |
download | dimension-95895823f75108cbfed2697498e4e097f493b236.tar.xz |
Fix some memory leaks.
dmnsn_delete_pigment() was not using the free_fn, and kD splay trees were not
being deleted after raytracing finished.
Diffstat (limited to 'libdimension/texture.c')
-rw-r--r-- | libdimension/texture.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libdimension/texture.c b/libdimension/texture.c index a5ebd90..3867628 100644 --- a/libdimension/texture.c +++ b/libdimension/texture.c @@ -32,11 +32,16 @@ dmnsn_new_pigment() return pigment; } -/* Free a dummy pigment */ +/* Free a pigment */ void dmnsn_delete_pigment(dmnsn_pigment *pigment) { - free(pigment); + if (pigment) { + if (pigment->free_fn) { + (*pigment->free_fn)(pigment->ptr); + } + free(pigment); + } } /* Allocate a dummy texture */ |