summaryrefslogtreecommitdiff
path: root/src/libtiff/tif_aux.c
diff options
context:
space:
mode:
authorscuri <scuri>2009-08-21 04:01:59 +0000
committerscuri <scuri>2009-08-21 04:01:59 +0000
commit6c39dd63dc4f91b358155c173a2cfdf4c6c5af3e (patch)
tree61b709d64e58613bc06b2c2947023d707b764eba /src/libtiff/tif_aux.c
parent59cda2efbd34938420a506daa60ab47168116484 (diff)
*** empty log message ***
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