summaryrefslogtreecommitdiff
path: root/src/libtiff/tif_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libtiff/tif_aux.c')
-rw-r--r--src/libtiff/tif_aux.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libtiff/tif_aux.c b/src/libtiff/tif_aux.c
index d33a144..8aad4eb 100644
--- a/src/libtiff/tif_aux.c
+++ b/src/libtiff/tif_aux.c
@@ -1,4 +1,4 @@
-/* $Id: tif_aux.c,v 1.1 2008/10/17 06:16:07 scuri Exp $ */
+/* $Id: tif_aux.c,v 1.2 2009/08/21 04:01:59 scuri Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -34,7 +34,8 @@
#include <math.h>
tdata_t
-_TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
+_TIFFCheckRealloc(TIFF* tif, tdata_t buffer,
+ size_t nmemb, size_t elem_size, const char* what)
{
tdata_t cp = NULL;
tsize_t bytes = nmemb * elem_size;
@@ -43,12 +44,19 @@ _TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
* XXX: Check for integer overflow.
*/
if (nmemb && elem_size && bytes / elem_size == nmemb)
- cp = _TIFFmalloc(bytes);
+ cp = _TIFFrealloc(buffer, bytes);
if (cp == NULL)
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space %s", what);
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "No space %s", what);
+
+ return cp;
+}
- return (cp);
+tdata_t
+_TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
+{
+ return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
}
static int