diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2004-08-04 06:34:52 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2009-04-06 16:07:42 -0500 |
commit | 272489dc69a8e20e6be44c5a3649bb8d78971124 (patch) | |
tree | c6caf49093c8dda1e9697fe9b56ed6ca57bba8e7 /pngmem.c | |
parent | 5fea36fb0018cdc68b7a61ae2d149c9cba6eb3ba (diff) | |
download | libpng-272489dc69a8e20e6be44c5a3649bb8d78971124.tar.gz |
Imported from libpng-1.2.6rc1.tarv1.2.6rc1
Diffstat (limited to 'pngmem.c')
-rw-r--r-- | pngmem.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng version 1.2.6beta4 - July 28, 2004 + * libpng version 1.2.6rc1 - August 4, 2004 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2004 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -423,10 +423,10 @@ png_malloc(png_structp png_ptr, png_uint_32 size) { png_voidp ret; +#ifdef PNG_USER_MEM_SUPPORTED if (png_ptr == NULL || size == 0) return (NULL); -#ifdef PNG_USER_MEM_SUPPORTED if(png_ptr->malloc_fn != NULL) ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); else @@ -442,6 +442,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size) png_voidp ret; #endif /* PNG_USER_MEM_SUPPORTED */ + if (png_ptr == NULL || size == 0) + return (NULL); + #ifdef PNG_MAX_MALLOC_64K if (size > (png_uint_32)65536L) { |