stop leaking FILE* objects when hashing
[libi2ncommon] / src / crypto.cpp
index d08f5d6..2aeb614 100644 (file)
@@ -168,9 +168,10 @@ string I2n::hash_file(string filename, algorithm algo)
         }
     }
 
+    fclose(file);
+
     if (!EVP_DigestFinal_ex(ctx.get(), ret.get(), &olen))
     {
-        fclose(file);
         throw runtime_error(ERROR_MESSAGE);
     }