summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2018-11-23 13:48:34 +0100
committerPavel Raiskup <praiskup@redhat.com>2018-11-23 14:28:32 +0100
commitecfd245fbd1b0000540c75da56ad25201d5393b4 (patch)
treed171770248cafe875abf125edce4a8c66a62e137 /cpio
parentc114bb9fb585e7d74158afa7afbe8c44922479de (diff)
downloadlibarchive-ecfd245fbd1b0000540c75da56ad25201d5393b4.tar.gz
Fix a few obvious resource leaks and strcpy() misuses
Per Coverity report.
Diffstat (limited to 'cpio')
-rw-r--r--cpio/cpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index 9dddf417..4fd394de 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -755,8 +755,10 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
}
if (cpio->option_rename)
destpath = cpio_rename(destpath);
- if (destpath == NULL)
+ if (destpath == NULL) {
+ archive_entry_free(entry);
return (0);
+ }
archive_entry_copy_pathname(entry, destpath);
/*