- 2020.07.16 22:15 "Re: [Tiff] program crashing when using TIFFClientOpen API during closing the file.", by Bob Friesenhahn
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)
}
- Allocate foo: foo* f = (foo*)malloc(sizeof(foo));
- 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