diff --git a/src/node.c b/src/node.c index 538c55c..8bbbde7 100644 --- a/src/node.c +++ b/src/node.c @@ -450,9 +450,7 @@ R3Route * r3_tree_match_route(const R3Node *tree, match_entry * entry) { for (i = n->route_len; i--; ) { if ( r3_route_cmp(n->routes[i], entry) == 0 ) { // Add slugs from found route to match_entry - for (int j = 0; j < n->routes[i]->slugs_len; j++) { - str_array_append_slug(entry->vars , n->routes[i]->slugs[j]); - } + entry->vars->slugs = n->routes[i]->slugs; return n->routes[i]; } } diff --git a/src/token.c b/src/token.c index 77620d2..0cefd88 100644 --- a/src/token.c +++ b/src/token.c @@ -21,7 +21,7 @@ str_array * str_array_create(int cap) { list->len = 0; list->slugs_len = 0; list->cap = cap; - list->slugs = (char**) zmalloc( sizeof(char*) * cap); + list->slugs = NULL; list->tokens = (char**) zmalloc( sizeof(char*) * cap); return list; } @@ -33,7 +33,6 @@ void str_array_free(str_array *l) { zfree(l->tokens[i]); } } - zfree(l->slugs); zfree(l->tokens); zfree(l); }