[pacman-dev] [PATCH] fixed erroneous memory access to newurl in alpm_db_remove_server
Barbu Paul - Gheorghe
barbu.paul.gheorghe at gmail.com
Tue Jul 31 02:01:31 EDT 2012
> Our current coding standard is to declare all variables at the start of
> the block.
>> if(vdata) {
>> _alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
>> db->treename, newurl);
>> free(vdata);
>
> Instead of creating a new variable, why not just free(newurl) here and
> keep the return?
The reason behind this is that I didn't want to have two calls to free(newurl)
for each execution branch (the same applies for the return statement).
Should I modify it with two calls or should I leave it this way and just fix the
coding standard violation that you mentioned above?
Have a nice day!
--
Barbu Paul - Gheorghe
Common sense is not so common - Voltaire
Visit My GitHub profile to see my open-source projects - https://github.com/paullik
More information about the pacman-dev
mailing list