FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 04-11-2011, 11:00 PM
Rémy Oudompheng
 
Default alpm_add_pkg() stealing ownership of allocated objects

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.
 
Old 04-12-2011, 06:50 AM
Xavier
 
Default alpm_add_pkg() stealing ownership of allocated objects

Rémy Oudompheng wrote:
> 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() ?
>


I cannot look now, but you might be right, and this definitely needs careful
reviewing. Can you open a ticket ?

I wonder if add_pkg should handle pmpkg from files differently and duplicate
these before adding them to the transaction. This would be less confusing to the
frontend, which would always need to free a pmpkg coming from pkg_load.
 

Thread Tools




All times are GMT. The time now is 04:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org