Explorar el Código

* Fix socket leak in readuserfile() when the file is in an invalid format

Bryan Drewery hace 17 años
padre
commit
7a4dd767cc
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      src/users.c

+ 2 - 0
src/users.c

@@ -620,10 +620,12 @@ int readuserfile(const char *file, struct userrec **ret)
   simple_snprintf(s, 180, "%s", temps);
   free(temps);
   if (s[1] < '4') {
+    fclose(f);
     putlog(LOG_MISC, "*", "!*! Empty or malformed userfile.");
     return 0;
   }
   if (s[1] > '4') {
+    fclose(f);
     putlog(LOG_MISC, "*", "Invalid userfile format.");
     return 0;
   }