Yes, it can be done calling g_free() directly. However, I would prefer the criteria to be "create a function for freeing the resource whenever we have created a new struct for the returned value". If a char* is returned, it is quite clear what you have to do, but you do not know that easily if it is a pointer to a struct particular to the reply, as it can have pointers to other stuff. So I think it is a good idea to encapsulate that behaviour, to avoid errors in case we add new fields to the struct and so on.