Explaining a little bit deeper, for example glib (I am a glib fan) normally allocates the memory inside the functions and the user has to call the appropriate functions to free them, for example:
That is a good approach and we are using it in many of the pdf_xxx_t "objects" in the library (such as pdf_stm_t or pdf_text_t). To create a pdf_XXX_t variable you usually do: pdf_XXX_t myxxx; myxxx = pdf_xxx_new (parameters...); and then, in order to dispose any used resources: pdf_xxx_destroy (myxxx); That schema works for both pointers and structures (heap or stack memory) and the details are not exposed to the user. I will change the implementation of both pdf_list and pdf_hash to follow that convention.
