From 5498bcf53f3104f68aeba8c9c57870bf0ed63ebc Mon Sep 17 00:00:00 2001 From: Gabriel Kihlman Date: Tue, 19 Mar 2019 14:49:45 +0100 Subject: [PATCH] Fix two minor memory leaks in error paths Found by cppcheck --- util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util.c b/util.c index f0d3938..1b18196 100644 --- a/util.c +++ b/util.c @@ -71,6 +71,7 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc } i = snprintf(userfile, len, "%s/%s", common_path, filename); if (i < 0 || i >= len) { + free(userfile); return 0; } *fn = userfile; @@ -85,6 +86,7 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc } i = snprintf(userfile, len, "%s/.yubico/%s", user->pw_dir, filename); if (i < 0 || i >= len) { + free(userfile); return 0; } *fn = userfile;