comparison src/free-hook.c @ 233:52952cbfc5b5 r20-5b15

Import from CVS: tag r20-5b15
author cvs
date Mon, 13 Aug 2007 10:14:14 +0200
parents 3d6bfa290dbd
children 966663fcf606
comparison
equal deleted inserted replaced
232:aa6545ea0638 233:52952cbfc5b5
220 220
221 EMACS_INT present = (EMACS_INT) gethash (ptr, pointer_table, 221 EMACS_INT present = (EMACS_INT) gethash (ptr, pointer_table,
222 (void **) &size); 222 (void **) &size);
223 223
224 if (!present) 224 if (!present)
225 {
225 /* This can only happen if you try to free something that didn't 226 /* This can only happen if you try to free something that didn't
226 come from malloc */ 227 come from malloc */
227 if (strict_free_check) 228 if (strict_free_check)
228 abort (); 229 abort ();
229 else 230 else
230 { 231 {
231 __free_hook = check_free; 232 __free_hook = check_free;
232 __malloc_hook = check_malloc; 233 __malloc_hook = check_malloc;
233 goto end; 234 goto end;
234 } 235 }
236 }
235 237
236 if (size < 0) 238 if (size < 0)
239 {
237 /* This happens when you free twice */ 240 /* This happens when you free twice */
238 if (strict_free_check) 241 if (strict_free_check)
239 abort (); 242 abort ();
240 else 243 else
241 { 244 {
242 __free_hook = check_free; 245 __free_hook = check_free;
243 __malloc_hook = check_malloc; 246 __malloc_hook = check_malloc;
244 goto end; 247 goto end;
245 } 248 }
249 }
246 puthash (ptr, (void *)-size, pointer_table); 250 puthash (ptr, (void *)-size, pointer_table);
247 #ifdef UNMAPPED_FREE 251 #ifdef UNMAPPED_FREE
248 /* Round up size to an even number of pages. */ 252 /* Round up size to an even number of pages. */
249 rounded_up_size = ROUND_UP_TO_PAGE (size); 253 rounded_up_size = ROUND_UP_TO_PAGE (size);
250 /* Protect the pages freed from all access */ 254 /* Protect the pages freed from all access */