mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -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)
|
void _alpm_backup_free(alpm_backup_t *backup)
|
||||||
{
|
{
|
||||||
free(backup->name);
|
ASSERT(backup != NULL, return);
|
||||||
free(backup->hash);
|
FREE(backup->name);
|
||||||
free(backup);
|
FREE(backup->hash);
|
||||||
|
FREE(backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *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)
|
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
|
||||||
{
|
{
|
||||||
|
ASSERT(conflict != NULL, return);
|
||||||
FREE(conflict->package2);
|
FREE(conflict->package2);
|
||||||
FREE(conflict->package1);
|
FREE(conflict->package1);
|
||||||
FREE(conflict);
|
FREE(conflict);
|
||||||
@ -301,6 +302,7 @@ error:
|
|||||||
*/
|
*/
|
||||||
void SYMEXPORT alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
void SYMEXPORT alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
||||||
{
|
{
|
||||||
|
ASSERT(conflict != NULL, return);
|
||||||
FREE(conflict->ctarget);
|
FREE(conflict->ctarget);
|
||||||
FREE(conflict->file);
|
FREE(conflict->file);
|
||||||
FREE(conflict->target);
|
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)
|
void _alpm_db_free(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
|
ASSERT(db != NULL, return);
|
||||||
/* cleanup pkgcache */
|
/* cleanup pkgcache */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
/* cleanup server list */
|
/* cleanup server list */
|
||||||
|
@ -335,6 +335,7 @@ error:
|
|||||||
|
|
||||||
void _alpm_delta_free(alpm_delta_t *delta)
|
void _alpm_delta_free(alpm_delta_t *delta)
|
||||||
{
|
{
|
||||||
|
ASSERT(delta != NULL, return);
|
||||||
FREE(delta->delta);
|
FREE(delta->delta);
|
||||||
FREE(delta->delta_md5);
|
FREE(delta->delta_md5);
|
||||||
FREE(delta->from);
|
FREE(delta->from);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
|
void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
|
ASSERT(dep != NULL, return);
|
||||||
FREE(dep->name);
|
FREE(dep->name);
|
||||||
FREE(dep->version);
|
FREE(dep->version);
|
||||||
FREE(dep->desc);
|
FREE(dep->desc);
|
||||||
@ -63,6 +64,7 @@ error:
|
|||||||
|
|
||||||
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
|
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
|
||||||
{
|
{
|
||||||
|
ASSERT(miss != NULL, return);
|
||||||
alpm_dep_free(miss->depend);
|
alpm_dep_free(miss->depend);
|
||||||
FREE(miss->target);
|
FREE(miss->target);
|
||||||
FREE(miss->causingpkg);
|
FREE(miss->causingpkg);
|
||||||
|
@ -31,6 +31,7 @@ alpm_graph_t *_alpm_graph_new(void)
|
|||||||
|
|
||||||
void _alpm_graph_free(void *data)
|
void _alpm_graph_free(void *data)
|
||||||
{
|
{
|
||||||
|
ASSERT(data != NULL, return);
|
||||||
alpm_graph_t *graph = data;
|
alpm_graph_t *graph = data;
|
||||||
alpm_list_free(graph->children);
|
alpm_list_free(graph->children);
|
||||||
free(graph);
|
free(graph);
|
||||||
|
Loading…
Reference in New Issue
Block a user