fhcount plugin: close file descriptor on failure
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 28 Nov 2015 22:15:24 +0000 (23:15 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Mon, 30 Nov 2015 21:57:29 +0000 (22:57 +0100)
src/fhcount.c

index 4c409b5..666dacc 100644 (file)
@@ -98,6 +98,7 @@ static int fhcount_read(void) {
   }
   if (fgets(buffer, buffer_len, fp) == NULL) {
     ERROR("fhcount: fgets: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+    fclose(fp);
     return(EXIT_FAILURE);
   }
   fclose(fp);