[pacman-dev] alpm_add_pkg() stealing ownership of allocated objects

Rémy Oudompheng remyoudompheng at gmail.com
Mon Apr 11 19:00:21 EDT 2011


Hello,

While doing experiments, I discovered that alpm_add_pkg() seemingly
stole the ownership of a pmpkg_t previously allocated by
alpm_pkg_load(). I am a bit confused here. I think the documentation
can definitely be improved here: can someone confirm the following
statements?

* a pmpkg_t* returned by alpm_pkg_load() must be freed by the caller
unless otherwise specified
* if alpm_add_pkg() is called on that package, then the caller MUST
NOT free the pmpkg_t afterwards.

Am I right? Are there any other functions with similar behaviour to
alpm_add_pkg() ?

Regards,
Rémy.


More information about the pacman-dev mailing list