diff --git a/include/types/dict.h b/include/types/dict.h index 9e4f41a68..006e91524 100644 --- a/include/types/dict.h +++ b/include/types/dict.h @@ -7,6 +7,7 @@ struct dict_entry { struct ebpt_node value; unsigned int refcount; + size_t len; }; struct dict { diff --git a/src/dict.c b/src/dict.c index 777530a20..c2580e179 100644 --- a/src/dict.c +++ b/src/dict.c @@ -36,6 +36,7 @@ static struct dict_entry *new_dict_entry(char *s) if (!de->value.key) goto err; + de->len = strlen(s); de->refcount = 1; return de; @@ -43,6 +44,7 @@ static struct dict_entry *new_dict_entry(char *s) err: free(de->value.key); de->value.key = NULL; + de->len = 0; free(de); return NULL; }