summaryrefslogtreecommitdiffstats
path: root/nsswitch
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-16 20:11:47 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-16 21:09:17 +1000
commita16328449171c1138bce3a9f32b7c1fa211e58d2 (patch)
tree203bd96df1cbef6123b9f2e073c3582782ac05b3 /nsswitch
parentff515ff4772a555facce75eead91ceff271713f5 (diff)
downloadsamba-a16328449171c1138bce3a9f32b7c1fa211e58d2.tar.gz
samba-a16328449171c1138bce3a9f32b7c1fa211e58d2.tar.xz
samba-a16328449171c1138bce3a9f32b7c1fa211e58d2.zip
wbclient: paranoid check for double free
added while tracking down a crash in the wbinfo blackbox test Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/libwbclient/wbclient.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/nsswitch/libwbclient/wbclient.c b/nsswitch/libwbclient/wbclient.c
index 15be255d45..19bb3e9e0a 100644
--- 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);
}