git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ff515ff
)
wbclient: paranoid check for double free
author
Andrew Tridgell
<tridge@samba.org>
Thu, 16 Sep 2010 10:11:47 +0000
(20:11 +1000)
committer
Andrew Tridgell
<tridge@samba.org>
Thu, 16 Sep 2010 11:09:17 +0000
(21:09 +1000)
added while tracking down a crash in the wbinfo blackbox test
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
nsswitch/libwbclient/wbclient.c
patch
|
blob
|
history
diff --git
a/nsswitch/libwbclient/wbclient.c
b/nsswitch/libwbclient/wbclient.c
index 15be255d45de33df57579ade614fd907d0b0c79f..19bb3e9e0a85348adabbd0fe19c6a397c2eec2a1 100644
(file)
--- a/
nsswitch/libwbclient/wbclient.c
+++ b/
nsswitch/libwbclient/wbclient.c
@@
-148,6
+148,7
@@
const char *wbcErrorString(wbcErr error)
}
#define WBC_MAGIC (0x7a2b0e1e)
+#define WBC_MAGIC_FREE (0x875634fe)
struct wbcMemPrefix {
uint32_t magic;
@@
-197,6
+198,10
@@
void wbcFreeMemory(void *p)
if (wbcMem->magic != WBC_MAGIC) {
return;
}
+
+ /* paranoid check to ensure we don't double free */
+ wbcMem->magic = WBC_MAGIC_FREE;
+
if (wbcMem->destructor != NULL) {
wbcMem->destructor(p);
}