From 1639c7b394658ecd7eb856ba9df0fd2269415ecd Mon Sep 17 00:00:00 2001 From: Perl 5 Porters Date: Sat, 7 Sep 1996 23:55:22 +0000 Subject: perl 5.003_05: ext/ODBM_File/ODBM_File.xs Attempt to correct for "Bad free" in Ultrix and HPUX versions of odbm. --- ext/ODBM_File/ODBM_File.xs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ext') diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs index c1b405ff89..92b443ce99 100644 --- a/ext/ODBM_File/ODBM_File.xs +++ b/ext/ODBM_File/ODBM_File.xs @@ -13,6 +13,21 @@ # endif #endif +#ifdef DBM_BUG_DUPLICATE_FREE +/* + * DBM on at least Ultrix and HPUX call dbmclose() from dbminit(), + * resulting in duplicate free() because dbmclose() does *not* + * check if it has already been called for this DBM. + * If some malloc/free calls have been done between dbmclose() and + * the next dbminit(), the memory might be used for something else when + * it is freed. + * Verified to work on ultrix4.3. Probably will work on HP/UX. + * Set DBM_BUG_DUPLICATE_FREE in the extension hint file. + */ +/* Close the previous dbm, and fail to open a new dbm */ +#define dbmclose() ((void) dbminit("/tmp/x/y/z/z/y")) +#endif + #include typedef void* ODBM_File; -- cgit v1.2.1