From 829463f8ee1a696cbbfd49eb08e7d78881335213 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Sat, 14 Feb 2015 08:48:56 +0100
Subject: [PATCH] Fix resource leak
---
autistdraw.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/autistdraw.c b/autistdraw.c
index b38eade..72484f7 100644
--- a/autistdraw.c
+++ b/autistdraw.c
@@ -803,14 +803,6 @@ export_irc (app_context_t *app)
static void
load (app_context_t *app)
{
- FILE *fp = fopen ("drawing.bin", "rb");
- if (!fp)
- {
- display ("Error opening file for reading.");
- beep ();
- return;
- }
-
// Client cannot load at all, the server would have send the new bitmap out
if (app->mode != NETWORK_MODE_STANDALONE)
{
@@ -819,6 +811,14 @@ load (app_context_t *app)
return;
}
+ FILE *fp = fopen ("drawing.bin", "rb");
+ if (!fp)
+ {
+ display ("Error opening file for reading.");
+ beep ();
+ return;
+ }
+
// Some way of loading/saving is better than no way, let's just do our job.
// The format neither standardised nor effective but it works for us.
// We just eat everything and make sure to not crash.