grim/guifications2

Don't leave an open fh around on error condition.
org.guifications.gf2
2009-06-28, Paul Aurich
29575a0b75a9
Parents c8aad3bfe212
Children 5e11548a6c1e
Don't leave an open fh around on error condition.

Pointed out by Adam Petaccia from my borrowing of this into Pidgin.
--- a/src/gf_file.c Mon Jun 08 21:50:08 2009 -0500
+++ b/src/gf_file.c Sun Jun 28 14:51:10 2009 -0700
@@ -35,8 +35,10 @@
if(!(src = g_fopen(source, "rb")))
return FALSE;
- if(!(dest = g_fopen(destination, "wb")))
+ if(!(dest = g_fopen(destination, "wb"))) {
+ fclose(src);
return FALSE;
+ }
while((chr = fgetc(src)) != EOF) {
fputc(chr, dest);