Small fix for the previous commit.

This commit is contained in:
Andrey Kiselev 2005-07-28 12:05:45 +00:00
parent 73a00a69bd
commit f185e92773

View File

@ -1,4 +1,4 @@
/* $Id: tif_aux.c,v 1.9 2005-07-28 11:35:12 dron Exp $ */ /* $Id: tif_aux.c,v 1.10 2005-07-28 12:05:45 dron Exp $ */
/* /*
* Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Sam Leffler
@ -33,17 +33,17 @@
#include "tif_predict.h" #include "tif_predict.h"
#include <math.h> #include <math.h>
char * tdata_t
_TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what) _TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
{ {
char *cp = NULL; tdata_t *cp = NULL;
tsize_t bytes = nmemb * elem_size; tsize_t bytes = nmemb * elem_size;
/* /*
* XXX: Check for integer overflow. * XXX: Check for integer overflow.
*/ */
if (nmemb && elem_size && bytes / elem_size == nmemb) if (nmemb && elem_size && bytes / elem_size == nmemb)
cp = (char*)_TIFFmalloc(bytes); cp = _TIFFmalloc(bytes);
if (cp == NULL) if (cp == NULL)
TIFFError(tif->tif_name, "No space %s", what); TIFFError(tif->tif_name, "No space %s", what);