mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-21 23:38:49 -05:00
Alpm, check for NULL in free-functions
Also, use FREE() instead of free() in _alpm_backup_free() to set the pointers to NULL. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
4c5bf09eec
commit
0c5dbdbfec
@ -76,9 +76,10 @@ alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg)
|
||||
|
||||
void _alpm_backup_free(alpm_backup_t *backup)
|
||||
{
|
||||
free(backup->name);
|
||||
free(backup->hash);
|
||||
free(backup);
|
||||
ASSERT(backup != NULL, return);
|
||||
FREE(backup->name);
|
||||
FREE(backup->hash);
|
||||
FREE(backup);
|
||||
}
|
||||
|
||||
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
|
||||
|
@ -68,6 +68,7 @@ error:
|
||||
*/
|
||||
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
|
||||
{
|
||||
ASSERT(conflict != NULL, return);
|
||||
FREE(conflict->package2);
|
||||
FREE(conflict->package1);
|
||||
FREE(conflict);
|
||||
@ -301,6 +302,7 @@ error:
|
||||
*/
|
||||
void SYMEXPORT alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
||||
{
|
||||
ASSERT(conflict != NULL, return);
|
||||
FREE(conflict->ctarget);
|
||||
FREE(conflict->file);
|
||||
FREE(conflict->target);
|
||||
|
@ -344,6 +344,7 @@ alpm_db_t *_alpm_db_new(const char *treename, int is_local)
|
||||
|
||||
void _alpm_db_free(alpm_db_t *db)
|
||||
{
|
||||
ASSERT(db != NULL, return);
|
||||
/* cleanup pkgcache */
|
||||
_alpm_db_free_pkgcache(db);
|
||||
/* cleanup server list */
|
||||
|
@ -335,6 +335,7 @@ error:
|
||||
|
||||
void _alpm_delta_free(alpm_delta_t *delta)
|
||||
{
|
||||
ASSERT(delta != NULL, return);
|
||||
FREE(delta->delta);
|
||||
FREE(delta->delta_md5);
|
||||
FREE(delta->from);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
|
||||
{
|
||||
ASSERT(dep != NULL, return);
|
||||
FREE(dep->name);
|
||||
FREE(dep->version);
|
||||
FREE(dep->desc);
|
||||
@ -63,6 +64,7 @@ error:
|
||||
|
||||
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
|
||||
{
|
||||
ASSERT(miss != NULL, return);
|
||||
alpm_dep_free(miss->depend);
|
||||
FREE(miss->target);
|
||||
FREE(miss->causingpkg);
|
||||
|
@ -31,6 +31,7 @@ alpm_graph_t *_alpm_graph_new(void)
|
||||
|
||||
void _alpm_graph_free(void *data)
|
||||
{
|
||||
ASSERT(data != NULL, return);
|
||||
alpm_graph_t *graph = data;
|
||||
alpm_list_free(graph->children);
|
||||
free(graph);
|
||||
|
Loading…
Reference in New Issue
Block a user