2020.07.16 21:04 "[Tiff] 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

Thanks Bob for the explanation.

If I have struct; say 'foo',

struct foo
{
     int* ptr1; //to be allocated by author of the struct using malloc
     int* ptr2; //to be allocated by author of the struct using malloc
    void*ptr3; // to be allocated by user of struct .i.e. client  using say malloc (not new operator)
}

  1. Allocate foo: foo* f = (foo*)malloc(sizeof(foo));
  2. Free foo: free(f);-> Will this not free memory pointed by ptr3 which is allocated and owned by user ?

Yes, it should. It will not do anything regarding allocations in ptr1 or ptr2 though.

C language provides hardly any automatic behavior other than to call atexit() handlers when the program calls exit() (or returns from main) and release the program's address space.

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