Browse Source

fixed memory leak by adding free of in->pair array in dictionary_free()

master
T. Meissner 10 years ago
parent
commit
290f6bbe4e
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      21st_century_c/chapter11/dict.c

+ 1
- 0
21st_century_c/chapter11/dict.c View File

@ -78,6 +78,7 @@ void dictionary_free(dictionary *in) {
for (size_t i = 0; i < in->length; i++) { for (size_t i = 0; i < in->length; i++) {
keyval_free(in->pairs[i]); keyval_free(in->pairs[i]);
} }
free(in->pairs);
free(in); free(in);
} }


Loading…
Cancel
Save