X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgdcmjasper%2Fsrc%2Flibjasper%2Fbase%2Fjas_malloc.c;h=ac2e067acd4291bcaa7a2792e2da439814a4f6cc;hb=bbe839f4ab724c326fddb9c7ac156d14d9c6da26;hp=6ad4ed2426d0bc7c0cd6dc68df8368cb239d1148;hpb=92caef4ab9527cc610e45d51e6fde0d94a045088;p=gdcm.git diff --git a/src/gdcmjasper/src/libjasper/base/jas_malloc.c b/src/gdcmjasper/src/libjasper/base/jas_malloc.c index 6ad4ed24..ac2e067a 100644 --- a/src/gdcmjasper/src/libjasper/base/jas_malloc.c +++ b/src/gdcmjasper/src/libjasper/base/jas_malloc.c @@ -64,7 +64,7 @@ /* * Memory Allocator * - * $Id: jas_malloc.c,v 1.1 2005/05/22 18:32:59 malaterre Exp $ + * $Id: jas_malloc.c,v 1.4 2005/10/21 08:14:19 jpr Exp $ */ /******************************************************************************\ @@ -90,7 +90,19 @@ void *jas_malloc(size_t size) { +#ifdef NULL_ON_MALLOC_0 +/* + // Apparently jasper does not take into account POSIX: + // http://www.opengroup.org/onlinepubs/007908799/xsh/malloc.html + // If the size of the space requested is 0, the behaviour is implementation-dependent; + // the value returned will be either a null pointer or a unique pointer. + + // As quick fix always over allocate so we avoid the case of the NULL pointer +*/ + return malloc(size+1); +#else return malloc(size); +#endif } void jas_free(void *ptr)