# HG changeset patch # User Elliott Sales de Andrade # Date 1272230980 0 # Node ID 1c3ee8378e2ee3a59e45eaded323d05b02c5cf4c # Parent 43c58f23c4b0a229ff64c601d4be2f66d42d1aca I'm tired of seeing this warning. diff -r 43c58f23c4b0 -r 1c3ee8378e2e libpurple/protocols/msn/msg.c --- 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. Click here to play it"), @@ -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. Click here to play it"), @@ -1013,7 +1013,9 @@ who, _("%s sent a voice clip, but it could not be saved"), NULL); - } + } + if (f) + fclose(f); g_free(path); }