From 4efaf1b1874abeb58c845dedab08d6410bedc2b0 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Fri, 3 Aug 2018 11:13:25 +0200
Subject: [PATCH] moved close up two lines to avoid segfaults.

---
 stemlab_discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stemlab_discovery.c b/stemlab_discovery.c
index 9f709e3..7b05b76 100644
--- a/stemlab_discovery.c
+++ b/stemlab_discovery.c
@@ -57,6 +57,8 @@ extern void status_text(const char *);
 
 #define ERROR_PREFIX "stemlab_discovery: "
 
+static size_t app_list_cb(void *buffer, size_t size, size_t nmemb, void *data);
+
 //
 // A bunch of callback-routines that use avahi, and are only needed by the
 // avahi-dependent version of stemlab_discovery(). These are only compiled
@@ -437,8 +439,8 @@ void stemlab_discovery() {
        p++;
      }
      if (len < 20) strcpy(inet,txt);
+     fclose(fpin);
    }
-   fclose(fpin);
    fprintf(stderr,"STEMLAB: using inet addr %s\n", inet);
    ip_address.sin_family = AF_INET;
    inet_aton(inet, &ip_address.sin_addr);
-- 
2.45.2