SHA256
1
0
forked from pool/antlr3c
antlr3c/fix-hash-double-free.patch
Jiri Slaby f17979d6c0 Accepting request 402674 from home:jirislaby:branches:network:telephony
- port patches from home:jirislaby:statica
  * add baselibs.conf to have 32bit libs too
  * add fix-LIST-memory-leak.patch
  * add fix-hash-double-free.patch
- use standard library versioning and obsolete the old packages

OBS-URL: https://build.opensuse.org/request/show/402674
OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=9
2016-07-25 11:40:19 +00:00

34 lines
991 B
Diff

From 6f5dad7d06620b4665303c542549d4c14f9fe784 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jirislaby@gmail.com>
Date: Sat, 19 Feb 2011 13:26:35 +0100
Subject: [PATCH] collections: hash, fix double free
We should not free the hash entry in antlr3HashFree when we didn't
strdup on that earlier.
I.e. make the free depend on table->doStrdup.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
src/antlr3collections.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/antlr3collections.c b/src/antlr3collections.c
index 01f3f7e..3e32dc3 100644
--- a/src/antlr3collections.c
+++ b/src/antlr3collections.c
@@ -237,7 +237,9 @@ antlr3HashFree(pANTLR3_HASH_TABLE table)
*/
if (entry->keybase.type == ANTLR3_HASH_TYPE_STR && entry->keybase.key.sKey != NULL)
{
- ANTLR3_FREE(entry->keybase.key.sKey);
+ if (table->doStrdup == ANTLR3_TRUE) {
+ ANTLR3_FREE(entry->keybase.key.sKey);
+ }
}
/* Free this entry
--
1.7.3.4