From 5b83650c3d6bfe2cd7526abb97d4a73cc6ea3dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 9 Jan 2016 17:23:36 +0000 Subject: [PATCH] Don't forget to free the line we read from the key file. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@876 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- lib/liboath/oath_key_from_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/liboath/oath_key_from_file.c b/lib/liboath/oath_key_from_file.c index 6211215..bd3bee1 100644 --- a/lib/liboath/oath_key_from_file.c +++ b/lib/liboath/oath_key_from_file.c @@ -64,6 +64,7 @@ oath_key_from_file(const char *filename) return (NULL); /* get first non-empty non-comment line */ line = openpam_readline(f, NULL, &len); + fclose(f); if (strlcmp("otpauth://", line, len) == 0) { key = oath_key_from_uri(line); } else { @@ -71,7 +72,7 @@ oath_key_from_file(const char *filename) "unrecognized key file format: %s", filename); key = NULL; } - fclose(f); + free(line); return (key); }