sorry looks like similar questions have been asked a lot but I did not found any which really answers my question.
I am using a library function which returns const char *
.
Within a function I am calling this library multiple time with a different string as result every time.
May example code explain:
void myfunc()
{
const char *string;
json_object *json;
/* Doing stuff, assigning data to *json */
// calling the function
// DEF: const char* json_object_to_json_string(struct json_object * obj)
string = json_object_to_json_string(json);
// doing stuff (strcpy etc.) with string
/* doing other stuff, never "free(string)" */
return;
}
So as the library function every time returns back a const char* (where content is different from previous call) when will the memory be released? Never? Within which functions can I access the content?
Soory, I am a little bit confused about this.
Thanks for letting me know!
/KNEBB