diff options
author | Alexei Gradinari <alex2grad@gmail.com> | 2016-06-16 16:56:19 -0400 |
---|---|---|
committer | Alexei Gradinari <alex2grad@gmail.com> | 2016-06-20 13:06:00 -0400 |
commit | 5134a8043a81b5b3d0b70ae3fbf7564f2526469a (patch) | |
tree | 23b8a01a91b6e148f00187b1b624e66ea5753b6e /res/res_phoneprov.c | |
parent | 03953d80346b3561305606f8509ab3ea2fa962a1 (diff) |
fix: memory leaks, resource leaks, out of bounds and bugs
ASTERISK-26119 #close
Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c
Diffstat (limited to 'res/res_phoneprov.c')
-rw-r--r-- | res/res_phoneprov.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c index df93c5bbc..71f875753 100644 --- a/res/res_phoneprov.c +++ b/res/res_phoneprov.c @@ -410,10 +410,13 @@ static int load_file(const char *filename, char **ret) fseek(f, 0, SEEK_END); len = ftell(f); fseek(f, 0, SEEK_SET); - if (!(*ret = ast_malloc(len + 1))) + if (!(*ret = ast_malloc(len + 1))) { + fclose(f); return -2; + } if (len != fread(*ret, sizeof(char), len, f)) { + fclose(f); free(*ret); *ret = NULL; return -3; |