Q:

Progress 4GL that calls a C function

I have been working in some C language function that is going to be called from a  Progress 4GL application and I found myself with the following doubts:
The C function uses malloc to dynamically allocate an array of chars and the idea is that the pointer that allocates that memory will be returned to the Progress 4GL process which originally sent a MEMPTR data type to hold the result of the C method. 
Basically the MEMPTR from Progress must be sent to the C function to "receive" the C generated array and use it when scope returns to it from de C function (a pass by reference between both languages where the C method "fills" the MEMPTR progress variable).
My questions is: 
When the Progress process finishes and the MEMPTR variable is "freed", does it free the malloc allocated memory in the C function as well?
and 
If I free the malloc allocated memory in the C function I'm guessing the Progress process will receive garbage data, Is this correct? 
Thanks for your time and help.
Greetings.

A:

4GL/ABL: How to Call WIN32 API Function: GetLongPathName
Progress 4GL doesn't manage that memory for you.  You need to provide a method to deallocate/free that memory. 
Yes, if you ever access free()'d memory, access to it becomes undefined - it may crash, it may give you garbage data, or your program could continue chugging away without error. 
Disclaimer: I work for Progress. 

