diff options
Diffstat (limited to 'pngmem.c')
-rw-r--r-- | pngmem.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.2.1beta3 - October 27, 2001 + * libpng 1.2.1beta4 - November 7, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -51,7 +51,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_struct dummy_struct; png_structp png_ptr = &dummy_struct; png_ptr->mem_ptr=mem_ptr; - struct_ptr = (*(malloc_fn))(png_ptr, size); + struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); } else #endif /* PNG_USER_MEM_SUPPORTED */ @@ -311,17 +311,10 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) #ifdef PNG_USER_MEM_SUPPORTED if(malloc_fn != NULL) { - if (mem_ptr != NULL) - { - png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - struct_ptr = (*(malloc_fn))(png_ptr, size); - } - else - { - struct_ptr = (*(malloc_fn))(png_structp_NULL, size); - } + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); if (struct_ptr != NULL) png_memset(struct_ptr, 0, size); return (struct_ptr); |