summaryrefslogtreecommitdiff
path: root/res/res_phoneprov.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-06-17 14:51:57 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-06-20 13:08:18 -0400
commit820ed3d4b35d5a906863375f0336e881530fa99c (patch)
tree76227e16c2da682f6101e5ab07254f25aa91ea67 /res/res_phoneprov.c
parent947f76a971ee54bd263ca5b50ac9446618ae06b1 (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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index b448c8e0b..2e4f87362 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);
ast_free(*ret);
*ret = NULL;
return -3;