diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-05 04:10:40 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-05 04:10:40 -0700 |
commit | 3af49338f8ef444bfb524938ba15fa9dc56082c6 (patch) | |
tree | 5a7fa23cfb2418314ead6d770d7fe8115279d3c3 | |
parent | 9ea94a3ac33559c956946a5c49aa2536b218e0fc (diff) | |
download | dartboat-3af49338f8ef444bfb524938ba15fa9dc56082c6.tar.gz dartboat-3af49338f8ef444bfb524938ba15fa9dc56082c6.tar.xz |
web: free elem namespace
-rw-r--r-- | web/web_dom.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web/web_dom.c b/web/web_dom.c index 5ce7a3f..eadca7f 100644 --- a/web/web_dom.c +++ b/web/web_dom.c @@ -13,12 +13,12 @@ struct dom_elem *dom_elem_init(char *ns, char *name, int size_attrs) e->ns = ns ? strdup(ns) : NULL; e->name = strdup(name); + e->content = NULL; e->n_attrs = 0; e->size_attrs = size_attrs; e->attr_names = malloc(size_attrs * sizeof(*(e->attr_names))); e->attr_vals = malloc(size_attrs * sizeof(*(e->attr_vals))); - e->content = NULL; return e; } @@ -30,10 +30,11 @@ void dom_elem_free(struct dom_elem *e) free(e->attr_vals[i]); } + free(e->ns); + free(e->name); free(e->content); free(e->attr_names); free(e->attr_vals); - free(e->name); free(e); } @@ -58,7 +59,7 @@ void dom_elem_add_attrd(struct dom_elem *e, char *name, double val) dom_elem_add_attr(e, name, str); } -void dom_append_elemv(char *sel, int elemc, struct dom_elem **elemv) +inline void dom_append_elemv(char *sel, int elemc, struct dom_elem **elemv) { EM_ASM({elemAppendElemv($0, $1, $2, $3, $4, $5, $6, $7, $8)}, sel, elemc, elemv, |