diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -426,6 +426,7 @@ // Check for reading errors so we don't return any data if we couldn't // read the entire file (or up to maxsize) if (ferror(f)) { + fclose(f); return std::make_pair(false, ""); } retval.append(buffer, buffer + n);