diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-31 18:12:18 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-31 18:12:18 +0100 |
commit | d58024ecec3d5b374389886427fed7f8e1e2bfa0 (patch) | |
tree | ef65c7acc450a1001c03fa3b9ac10242213d6128 /src/core | |
parent | fce371e22a14ed55f246e1fe5413c5058b7fcae6 (diff) | |
download | weechat-d58024ecec3d5b374389886427fed7f8e1e2bfa0.zip |
Check that buffer pointer is not NULL in upgrade_file_read_buffer
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-upgrade-file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c index 9fd024002..fa34f5225 100644 --- a/src/core/wee-upgrade-file.c +++ b/src/core/wee-upgrade-file.c @@ -479,7 +479,10 @@ int upgrade_file_read_buffer (struct t_upgrade_file *upgrade_file, void **buffer, int *size) { - if (buffer && *buffer) + if (!buffer) + return 0; + + if (*buffer) { free (*buffer); *buffer = NULL; @@ -495,7 +498,7 @@ upgrade_file_read_buffer (struct t_upgrade_file *upgrade_file, *buffer = malloc (*size); - if (buffer && *buffer) + if (*buffer) { if (fread (*buffer, *size, 1, upgrade_file->file) <= 0) return 0; |