AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2020.07.16 21:04 "[Tiff] program crashing when using TIFFClientOpen API during closing the file.", by Upanita Goswami
2020.07.16 22:15 "Re: [Tiff] program crashing when using TIFFClientOpen API during closing the file.", by Bob Friesenhahn
2020.07.16 23:12 "[Tiff] Fw: program crashing when using TIFFClientOpen API during closing the file.", by Upanita Goswami
2020.07.17 13:01 "Re: [Tiff] Fw: program crashing when using TIFFClientOpen API during closing the file.", by Bob Friesenhahn
2020.07.17 14:24 "Re: [Tiff] Fw: program crashing when using TIFFClientOpen API during closing the file.", by Upanita Goswami
2020.07.17 18:22 "Re: [Tiff] Fw: program crashing when using TIFFClientOpen API during closing the file.", by Bob Friesenhahn

2020.07.17 13:01 "Re: [Tiff] Fw: program crashing when using TIFFClientOpen API during closing the file.", by Bob Friesenhahn

Thanks Bob. We can use valgrind to check.

If we use thandle and allocate memory using 'new', will libtiff free it in _TIFFFree and cause issues? What is the pattern that needs to be followed?

The handle is just an opaque handle and libtiff does not know what it is. Libtiff does not free it.

Since you are allocating some memory using C++ new, it is wise to be very aware that standard C language malloc and C++ new are different memory allocation systems so one must take care to always free using the correct deallocator. Libtiff itself (C library part) only uses malloc/realloc/free. The lifetime of C++ memory allocations may be different than with C since C++ supports destructors.

At one time libtiff only supported 32-bit offsets but since 4.0 it supports 64-bit offsets. With care, a program which properly uses libtiff's typedefs will compile properly for both. When I updated GraphicsMagick for libtiff 4.0, I initially did encounter crashes until I fixed the functions passed to TIFFClientOpen().

This is how I run valgrind:

   valgrind --tool=memcheck --leak-check=full --read-var-info=yes --track-origins=yes --num-callers=12 program ...

Bob

Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt