Skip Menu |
 

To: krb5-bugs@mit.edu
From: Yang Xiao <xiaoyang@iie.ac.cn>
Subject: Memory leak in function main() in src/tests/threads/profread.c and src/tests/threads/gss-perf.c.
Date: Tue, 18 Sep 2018 15:13:42 +0800

Hi,

There should be function call for free(tinfo) at the end of the function main() in profread.c and gss-perf.c. Otherwise, there would be memory leaks. The patches for main() in profread.c and gss-perf.c are the same as below.

This is the similar issue as trunk@23559.

commit ebfd96a98ccb8f7df042cadbeefa00ee4761b9fa
Author: Ezra Peisach <epeisach@mit.edu>
Date:   Thu Dec 31 23:18:16 2009 +0000

    Free tinfo at end - so program runs with new memory leaks

    git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23559 dc483132-0cff-0310-8789-dd5450dbe970

diff --git a/src/tests/threads/init_ctx.c b/src/tests/threads/init_ctx.c
index 208104d..1629060 100644
--- a/src/tests/threads/init_ctx.c
+++ b/src/tests/threads/init_ctx.c
@@ -274,5 +274,6 @@ main (int argc, char *argv[])
             100 * total / wallclock / n_threads);
     printf ("Total CPU use per iteration per thread: %Lfms\n",
             1000 * total / n_threads / iter_count);
+    free(tinfo);
     return 0;
 }

Young

tinfo is a static global variable in both test programs, so the memory
is still reachable at program exit; as such this isn't really a memory
leak.

Also, as these are test programs, it's only important to fix memory
leaks in them if they create false positives in static or dynamic
analysis tools which detect memory bugs. Was this issue discovered
using a tool, or through code inspection?
Date: Wed, 19 Sep 2018 09:52:47 +0800 (GMT+08:00)
From: 肖扬 <xiaoyang@iie.ac.cn>
To: rt-comment@krbdev.mit.edu
Subject: > [krbdev.mit.edu #8739] Memory leak in function main() in src/tests/threads/profread.c and src/tests/threads/gss-perf.c.
RT-Send-Cc: