2004.10.14 07:58 "[Tiff] WIN32 _TIFFrealloc() bug?", by Ville Herva

2004.10.17 16:47 "RE: [Tiff] WIN32 _TIFFrealloc() bug?", by Larry Grill

Hi,

I thought this one was fixed in the general release some time ago. If you search the message archive you should find the same topic from me, but if you change the TIFFrealloc method this way, it will be fine. This is corrected in the 3.7 release.

tdata_t
_TIFFrealloc(tdata_t p, tsize_t s)
{
  void* pvTmp;
  tsize_t old;

  if(p==NULL)
    return ((tdata_t)GlobalAlloc(GMEM_FIXED, s));

  old = GlobalSize(p);

  if (old>=s)
  {
    if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
      CopyMemory(pvTmp, p, s);
      GlobalFree(p);
    }
  }
  else
  {
    if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
      CopyMemory(pvTmp, p, old);
      GlobalFree(p);
    }
  }
  return ((tdata_t)pvTmp);
}

Larry M. Grill
larry@nuglyphix.com
www.nuglyphix.com