As far as I can tell from the answers to other SO questions, I don't need to free fixed-length arrays like the following:
unsigned char buffer[16];
But in general one has to free memory whenever calling malloc
, memcpy, etc.
My Question is: Do I need to call free
in the following scenario:
unsigned char buffer[16];
memcpy(buffer, source, 16);
...
free(buffer); // needed?
To be more precise: Is the decision, whether heap or stack is used, based on the declaration or initialization of a variable?