Usage of Balloc in Newlib

Sebastian Huber sebastian.huber@embedded-brains.de
Mon Nov 12 10:08:00 GMT 2012


Hello,

the Balloc() function can return NULL in case _calloc_r() returns NULL.  All 
users of Balloc() in Newlib don't check for a NULL pointer.  Is this Balloc() 
supposed to never fail?

./libc/stdlib/strtod.c:         bd = Balloc(ptr,bd0->_k);
./libc/stdlib/strtod.c-         Bcopy(bd, bd0);
--
./libc/stdlib/mprec.c:    b1 = Balloc (ptr, b->_k + 1);
./libc/stdlib/mprec.c-    Bcopy (b1, b);
--
./libc/stdlib/mprec.c:  b = Balloc (ptr, k);
./libc/stdlib/mprec.c-  b->_x[0] = y9;
--
./libc/stdlib/mprec.c:  b = Balloc (ptr, k + 1);
./libc/stdlib/mprec.c-  b->_x[0] = y9 & 0xffff;
--
./libc/stdlib/mprec.c:  b = Balloc (ptr, 1);
./libc/stdlib/mprec.c-  b->_x[0] = i;
--
./libc/stdlib/mprec.c:  c = Balloc (ptr, k);
./libc/stdlib/mprec.c-  for (x = c->_x, xa = x + wc; x < xa; x++)
--
./libc/stdlib/mprec.c:  b1 = Balloc (ptr, k1);
./libc/stdlib/mprec.c-  x1 = b1->_x;
--
./libc/stdlib/mprec.c:      c = Balloc (ptr, 0);
./libc/stdlib/mprec.c-      c->_wds = 1;
--
./libc/stdlib/mprec.c:  c = Balloc (ptr, a->_k);
./libc/stdlib/mprec.c-  c->_sign = i;
--
./libc/stdlib/mprec.c:  b = Balloc (ptr, 1);
./libc/stdlib/mprec.c-#else
./libc/stdlib/mprec.c:  b = Balloc (ptr, 2);
./libc/stdlib/mprec.c-#endif
--
./libc/stdlib/ldtoa.c:_REENT_MP_RESULT(ptr) = Balloc (ptr, 
_REENT_MP_RESULT_K(ptr));
./libc/stdlib/ldtoa.c-
--
./libc/stdlib/dtoa.c:  _REENT_MP_RESULT(ptr) = Balloc (ptr, 
_REENT_MP_RESULT_K(ptr));
./libc/stdlib/dtoa.c-  s = s0 = (char *) _REENT_MP_RESULT(ptr);
--
./libc/stdlib/dtoa.c:     mhi = Balloc (ptr, mhi->_k);
./libc/stdlib/dtoa.c-     Bcopy (mhi, mlo);
--
./libc/stdlib/gdtoa-gethex.c:                   b1 = Balloc(ptr, b->_k+1);
./libc/stdlib/gdtoa-gethex.c-                   Bcopy(b1, b);
--
./libc/stdlib/gdtoa-gethex.c:   b = Balloc(ptr, k);
./libc/stdlib/gdtoa-gethex.c-   x = b->_x;
--
./libc/machine/powerpc/simdldtoa.c:_REENT_MP_RESULT(ptr) = Balloc (ptr, 
_REENT_MP_RESULT_K(ptr));
./libc/machine/powerpc/simdldtoa.c-outstr = (char *)_REENT_MP_RESULT(ptr);

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list