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 -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -