Mercurial > pidgin.yaz
changeset 30193:1c3ee8378e2e
I'm tired of seeing this warning.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 25 Apr 2010 21:29:40 +0000 |
parents | 43c58f23c4b0 |
children | 0f1df8098d00 |
files | libpurple/protocols/msn/msg.c |
diffstat | 1 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c Sun Apr 25 02:29:09 2010 +0000 +++ b/libpurple/protocols/msn/msg.c Sun Apr 25 21:29:40 2010 +0000 @@ -970,14 +970,13 @@ static void got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) { - FILE *f; + FILE *f = NULL; char *path = NULL; const char *who = slpcall->slplink->remote_user; purple_debug_info("msn", "Received wink from %s\n", who); - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); + if ((f = purple_mkstemp(&path, TRUE)) && + (fwrite(data, size, 1, f) == size)) { datacast_inform_user(slpcall->slplink->swboard, who, _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), @@ -988,21 +987,22 @@ who, _("%s sent a wink, but it could not be saved"), NULL); - } + } + if (f) + fclose(f); g_free(path); } static void got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) { - FILE *f; + FILE *f = NULL; char *path = NULL; const char *who = slpcall->slplink->remote_user; purple_debug_info("msn", "Received voice clip from %s\n", who); - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); + if ((f = purple_mkstemp(&path, TRUE)) && + (fwrite(data, size, 1, f) == size)) { datacast_inform_user(slpcall->slplink->swboard, who, _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), @@ -1013,7 +1013,9 @@ who, _("%s sent a voice clip, but it could not be saved"), NULL); - } + } + if (f) + fclose(f); g_free(path); }