1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

Rework code to avoid using a pointer after freeing it. Aside from the

possibility of memory becoming undereferenceable when it is freed, this
change should have no effect on bsdtar behaviour.

Found by:	Coverity Prevent
This commit is contained in:
Colin Percival 2008-06-09 14:03:55 +00:00
parent a70537835f
commit af58f6feff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179677

View File

@ -369,9 +369,11 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
}
if (r == 1) {
archive_entry_copy_pathname(entry, subst_name);
free(subst_name);
if (*subst_name == '\0')
if (*subst_name == '\0') {
free(subst_name);
return -1;
} else
free(subst_name);
name = archive_entry_pathname(entry);
}