From 3af49338f8ef444bfb524938ba15fa9dc56082c6 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Thu, 5 May 2022 04:10:40 -0700 Subject: web: free elem namespace --- web/web_dom.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'web/web_dom.c') 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, -- cgit v1.2.3-70-g09d2