diff options
author | Luka Perkov <luka@openwrt.org> | 2013-10-15 12:44:19 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-10-15 13:16:32 +0200 |
commit | 87be3798a9c01d70d707760a2a7d5b8aca9df365 (patch) | |
tree | 10a3e650c44ad69ad180295c838afb4d0434e3c1 /list.c | |
parent | 42429219a90d697d88c5203bddef34c31e552643 (diff) | |
download | uci-87be3798a9c01d70d707760a2a7d5b8aca9df365.tar.gz |
style: free(NULL) is perfectly valid so we can drop some checks
Signed-off-by: Luka Perkov <luka@openwrt.org>
Diffstat (limited to 'list.c')
-rw-r--r-- | list.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -66,8 +66,7 @@ done: __private void uci_free_element(struct uci_element *e) { - if (e->name) - free(e->name); + free(e->name); if (!uci_list_empty(&e->list)) uci_list_del(&e->list); free(e); @@ -239,8 +238,7 @@ uci_free_package(struct uci_package **package) if(!p) return; - if (p->path) - free(p->path); + free(p->path); uci_foreach_element_safe(&p->sections, tmp, e) { uci_free_section(uci_to_section(e)); } @@ -502,8 +500,7 @@ int uci_rename(struct uci_context *ctx, struct uci_ptr *ptr) uci_add_delta(ctx, &p->delta, UCI_CMD_RENAME, ptr->section, ptr->option, ptr->value); n = uci_strdup(ctx, ptr->value); - if (e->name) - free(e->name); + free(e->name); e->name = n; if (e->type == UCI_TYPE_SECTION) |