~vorlon/ubuntu/natty/eglibc/multiarch

« back to all changes in this revision

Viewing changes to malloc/mcheck.c

  • Committer: Steve Langasek
  • Date: 2011-02-18 21:18:44 UTC
  • mfrom: (103.1.7 eglibc)
  • Revision ID: steve.langasek@linaro.org-20110218211844-lodmi8b1qhyq3f3x
Tags: 2.13~pre1-0ubuntu1+multiarch.1
merge from natty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Standard debugging hooks for `malloc'.
2
 
   Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
 
2
   Copyright (C) 1990-1997,1999,2000-2002,2007,2010
 
3
   Free Software Foundation, Inc.
3
4
   This file is part of the GNU C Library.
4
5
   Written May 1989 by Mike Haertel.
5
6
 
25
26
# include <stdint.h>
26
27
# include <stdio.h>
27
28
# include <libintl.h>
 
29
# include <errno.h>
28
30
#endif
29
31
 
30
32
/* Old hook values.  */
209
211
  if (pedantic)
210
212
    mcheck_check_all ();
211
213
 
 
214
  if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
 
215
    {
 
216
      __set_errno (ENOMEM);
 
217
      return NULL;
 
218
    }
 
219
 
212
220
  __malloc_hook = old_malloc_hook;
213
221
  if (old_malloc_hook != NULL)
214
222
    hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1,
241
249
 
242
250
  slop = (sizeof *hdr + alignment - 1) & -alignment;
243
251
 
 
252
  if (size > ~((size_t) 0) - (slop + 1))
 
253
    {
 
254
      __set_errno (ENOMEM);
 
255
      return NULL;
 
256
    }
 
257
 
244
258
  __memalign_hook = old_memalign_hook;
245
259
  if (old_memalign_hook != NULL)
246
260
    block = (*old_memalign_hook) (alignment, slop + size + 1, caller);
276
290
  if (pedantic)
277
291
    mcheck_check_all ();
278
292
 
 
293
  if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
 
294
    {
 
295
      __set_errno (ENOMEM);
 
296
      return NULL;
 
297
    }
 
298
 
279
299
  if (ptr)
280
300
    {
281
301
      hdr = ((struct hdr *) ptr) - 1;