From: David Levine Date: Sat, 16 Feb 2013 14:21:10 +0000 (-0600) Subject: Plugged small memory leak in etcpath(). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/b3496a6cccc205e49560cb5a8147fce3fc0fcc70?hp=e06ec1e3e331c6f77df73fbcf0da5b733f22725a Plugged small memory leak in etcpath(). --- diff --git a/config/config.c b/config/config.c index 2b999f87..d29f8a2e 100644 --- a/config/config.c +++ b/config/config.c @@ -68,8 +68,13 @@ try_it: default: /* Check nmh Mail directory */ - if (access ((cp = m_mailpath (file)), R_OK) != NOTOK) + if (access ((cp = m_mailpath (file)), R_OK) != NOTOK) { + /* Will leak because caller doesn't know cp was + dynamically allocated. */ return cp; + } else { + free (cp); + } } /* Check nmh `etc' directory */