mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
fix: memory leaks, resource leaks, out of bounds and bugs
ASTERISK-26119 #close Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user