summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-11-28 17:33:01 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-11-28 17:33:01 +0000
commit0472ac5d117908a4ef612722960411c58e824999 (patch)
tree554e13b71ec7c7a915d225e7f2e81eee174ef4b2
parenta5747964ec29ece7cccb981330e073748f2fd447 (diff)
fix mem leak in HashHash() (bug 5171)
-rw-r--r--libdrm/xf86drmHash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libdrm/xf86drmHash.c b/libdrm/xf86drmHash.c
index 368dfe21..3ee9c028 100644
--- a/libdrm/xf86drmHash.c
+++ b/libdrm/xf86drmHash.c
@@ -102,12 +102,14 @@
#define HASH_RANDOM_DECL
#define HASH_RANDOM_INIT(seed) srandom(seed)
#define HASH_RANDOM random()
+#define HASH_RANDOM_DESTROY
#else
#define HASH_ALLOC drmMalloc
#define HASH_FREE drmFree
#define HASH_RANDOM_DECL void *state
#define HASH_RANDOM_INIT(seed) state = drmRandomCreate(seed)
#define HASH_RANDOM drmRandom(state)
+#define HASH_RANDOM_DESTROY drmRandomDestroy(state)
#endif
@@ -148,6 +150,7 @@ static unsigned long HashHash(unsigned long key)
HASH_RANDOM_DECL;
HASH_RANDOM_INIT(37);
for (i = 0; i < 256; i++) scatter[i] = HASH_RANDOM;
+ HASH_RANDOM_DESTROY;
++init;
}