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

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -