Mercurial > pidgin
diff libpurple/protocols/msn/msg.c @ 30730:f8ec889c5bce
propagate from branch 'im.pidgin.pidgin' (head f6cdf8776559775f9a4a72563e69741e139518bd)
to branch 'im.pidgin.cpw.qulogic.msnp16' (head ee6655c65ffae7f61734aa5a05267a3f5a4fc0de)
| author | Elliott Sales de Andrade <qulogic@pidgin.im> |
|---|---|
| date | Mon, 10 May 2010 23:21:44 +0000 |
| parents | c5a7516418c7 0f1df8098d00 |
| children | 7fa07adbe482 66e7fe9f7810 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c Fri Apr 23 16:58:03 2010 +0000 +++ b/libpurple/protocols/msn/msg.c Mon May 10 23:21:44 2010 +0000 @@ -966,14 +966,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, 1, size, f) == size)) { datacast_inform_user(slpcall->slplink->swboard, who, _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), @@ -984,21 +983,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, 1, size, f) == size)) { datacast_inform_user(slpcall->slplink->swboard, who, _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), @@ -1009,7 +1009,9 @@ who, _("%s sent a voice clip, but it could not be saved"), NULL); - } + } + if (f) + fclose(f); g_free(path); }
