summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/backup.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/backup.c')
-rw-r--r--lib/libalpm/backup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index c2989b6d..aeb41316 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -87,10 +87,15 @@ alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
alpm_backup_t *newbackup;
CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL);
- STRDUP(newbackup->name, backup->name, return NULL);
- STRDUP(newbackup->hash, backup->hash, return NULL);
+ STRDUP(newbackup->name, backup->name, goto error);
+ STRDUP(newbackup->hash, backup->hash, goto error);
return newbackup;
+
+error:
+ free(newbackup->name);
+ free(newbackup);
+ return NULL;
}
/* vim: set noet: */