I just wonder if freeing memory that has been allocated by another function is considered bad style.
Code:#include <stdio.h> #include <stdlib.h> int *fun (void); int main (void) { int *ptr; ptr = fun (); free (ptr); return 0; } int *fun (void) { int *ptr; ptr = malloc (sizeof (int)); return ptr; }