c - I have to "free" rootValue, but how do I do that before returning it? -


json_value* createjsonobject() {     json_value *rootvalue = json_value_init_object();     json_object *rootobject = json_value_get_object(rootvalue);     return rootvalue; } 

i can't return rootvalue, because need use

json_value_free(rootvalue); 

otherwise memory stay open. how do this?

you can't return freed. (well can it, won't work.)

state in function contract, caller has free returned value after usage.


Comments