summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-11-22 13:53:15 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2012-11-22 13:53:15 +0100
commit6c0251d145e44b7cdfeb9767c615646fb8f51320 (patch)
tree68b3824ef4357e9050e9e002b164d9e0d9691586
parent4130a5170175db47f433e86e880169701ac0173d (diff)
udf: Don't return freed memory from udf_fopenHEADmaster
When trying to open a file located in the root directory of the UDF filesystem, we call udf_ff_open with the dirent corresponding to the root dir and the filename. In this case, udf_ff_open will return the same dirent as the one that was passed as argument, so we must not free it as we'll be returning it. This causes a crash with iso-read when trying to read a file located at the root of the image.
-rw-r--r--lib/udf/udf_fs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/udf/udf_fs.c b/lib/udf/udf_fs.c
index 5f5add7b..1e0601e7 100644
--- a/lib/udf/udf_fs.c
+++ b/lib/udf/udf_fs.c
@@ -257,7 +257,8 @@ udf_fopen(udf_dirent_t *p_udf_root, const char *psz_name)
p_udf_root->psz_name, p_udf_root->b_dir,
p_udf_root->b_parent);
p_udf_file = udf_ff_traverse(p_udf_dirent, psz_token);
- udf_dirent_free(p_udf_dirent);
+ if (p_udf_file != p_udf_dirent)
+ udf_dirent_free(p_udf_dirent);
}
else if ( 0 == strncmp("/", psz_name, sizeof("/")) ) {
return udf_new_dirent(&p_udf_root->fe, p_udf_root->p_udf,