summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 14:12:06 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 15:30:03 +0100
commit84502bf120e45a8ce573bdf6e5c07eb9f59a9d6e (patch)
tree3acd367313f93bad0c87cd175a46c67dbaad7582
parent64255d88391b8a531f0d358e22bdf12c0c79cd5d (diff)
mkfs.ubifs: propperly cleanup in ALL interpret_table_entry error paths
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--ubifs-utils/mkfs.ubifs/devtable.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ubifs-utils/mkfs.ubifs/devtable.c b/ubifs-utils/mkfs.ubifs/devtable.c
index 0afea90..aa815fb 100644
--- a/ubifs-utils/mkfs.ubifs/devtable.c
+++ b/ubifs-utils/mkfs.ubifs/devtable.c
@@ -219,8 +219,10 @@ static int interpret_table_entry(const char *line)
}
}
- if (increment != 0 && count == 0)
- return err_msg("count cannot be zero if increment is non-zero");
+ if (increment != 0 && count == 0) {
+ err_msg("count cannot be zero if increment is non-zero");
+ goto out_free;
+ }
/*
* Add the file/directory/device node (last component of the path) to
@@ -245,8 +247,10 @@ static int interpret_table_entry(const char *line)
dbg_msg(3, "inserting '%s' into name hash table (major %d, minor %d)",
name, major(nh_elt->dev), minor(nh_elt->dev));
- if (hashtable_search(ph_elt->name_htbl, name))
- return err_msg("'%s' is referred twice", buf);
+ if (hashtable_search(ph_elt->name_htbl, name)) {
+ err_msg("'%s' is referred twice", buf);
+ goto out_free;
+ }
nh_elt->name = name;
if (!hashtable_insert(ph_elt->name_htbl, name, nh_elt)) {