// Clone the entry
entry = archive_entry_clone(file->entry);
if (!entry)
- return NULL;
+ goto ERROR;
// Flags
if (pakfire_file_has_flag(file, PAKFIRE_FILE_CONFIG)) {
// Compute any required file digests
r = pakfire_file_compute_digests(file, digest_types);
if (r)
- return NULL;
+ goto ERROR;
// Copy digests
r = pakfire_file_write_fcaps(file, &cap_data);
if (r) {
ERROR(file->pakfire, "Could not export capabilities: %m\n");
- return NULL;
+ goto ERROR;
}
// Store capabilities in archive entry
}
return entry;
+
+ERROR:
+ if (entry)
+ archive_entry_free(entry);
+
+ return NULL;
}
static void pakfire_file_free(struct pakfire_file* file) {