sgwdynspeed: properly close the speed file
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Oct 2015 08:39:12 +0000 (10:39 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Oct 2015 12:47:57 +0000 (14:47 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/sgwdynspeed/src/speedFile.c

index b6d9d04..fa4fb69 100644 (file)
@@ -184,6 +184,7 @@ void readSpeedFile(char * fileName) {
        FILE * fp = NULL;
        void * mtim;
        unsigned int lineNumber = 0;
+
        char * name = NULL;
        char * value = NULL;
 
@@ -288,7 +289,10 @@ void readSpeedFile(char * fileName) {
          refresh_smartgw_netmask();
        }
 
-       out: if (fd >= 0) {
+       out: if (fp) {
+               fclose(fp);
+       }
+       if (fd >= 0) {
                close(fd);
        }
 }