From a16328449171c1138bce3a9f32b7c1fa211e58d2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Sep 2010 20:11:47 +1000 Subject: wbclient: paranoid check for double free added while tracking down a crash in the wbinfo blackbox test Pair-Programmed-With: Andrew Bartlett --- nsswitch/libwbclient/wbclient.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nsswitch') 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); } -- cgit