diff options
author | James Christopher Adduono <jc@adduono.com> | 2016-03-01 22:01:53 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2016-03-02 20:04:11 +0100 |
commit | 6f57f7c60167b11e0e7769310aa8878d2980a3da (patch) | |
tree | 8c19ef8ad663ef7155b5b382085130d51c926a94 /libtar/handle.c | |
parent | Unix file endings and remove execute permission (diff) | |
download | android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.gz android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.bz2 android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.lz android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.xz android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.zst android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.zip |
Diffstat (limited to '')
-rw-r--r-- | libtar/handle.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libtar/handle.c b/libtar/handle.c index ae974b9f0..28a7dc247 100644 --- a/libtar/handle.c +++ b/libtar/handle.c @@ -31,7 +31,7 @@ static tartype_t default_type = { open, close, read, write }; static int -tar_init(TAR **t, char *pathname, tartype_t *type, +tar_init(TAR **t, const char *pathname, tartype_t *type, int oflags, int mode, int options) { if ((oflags & O_ACCMODE) == O_RDWR) @@ -66,7 +66,7 @@ tar_init(TAR **t, char *pathname, tartype_t *type, /* open a new tarfile handle */ int -tar_open(TAR **t, char *pathname, tartype_t *type, +tar_open(TAR **t, const char *pathname, tartype_t *type, int oflags, int mode, int options) { if (tar_init(t, pathname, type, oflags, mode, options) == -1) @@ -82,6 +82,7 @@ tar_open(TAR **t, char *pathname, tartype_t *type, (*t)->fd = (*((*t)->type->openfunc))(pathname, oflags, mode); if ((*t)->fd == -1) { + libtar_hash_free((*t)->h, NULL); free(*t); return -1; } @@ -91,7 +92,7 @@ tar_open(TAR **t, char *pathname, tartype_t *type, int -tar_fdopen(TAR **t, int fd, char *pathname, tartype_t *type, +tar_fdopen(TAR **t, int fd, const char *pathname, tartype_t *type, int oflags, int mode, int options) { if (tar_init(t, pathname, type, oflags, mode, options) == -1) @@ -121,6 +122,8 @@ tar_close(TAR *t) libtar_hash_free(t->h, ((t->oflags & O_ACCMODE) == O_RDONLY ? free : (libtar_freefunc_t)tar_dev_free)); + if (t->th_pathname != NULL) + free(t->th_pathname); free(t); return i; |