The getpwnam() function returns a pointer to a passwd structure. so Just need to declare a pointer to this structure, not to allocate memory for it.
Signed-off-by: Wei,Jiangang <weijg.f...@cn.fujitsu.com> --- testcases/kernel/syscalls/ipc/lib/libipc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/testcases/kernel/syscalls/ipc/lib/libipc.c b/testcases/kernel/syscalls/ipc/lib/libipc.c index f10e257..93fe6ce 100644 --- a/testcases/kernel/syscalls/ipc/lib/libipc.c +++ b/testcases/kernel/syscalls/ipc/lib/libipc.c @@ -141,13 +141,7 @@ void rm_sema(int sem_id) */ int getuserid(char *user) { - struct passwd *ent; - - /* allocate some space for the passwd struct */ - if ((ent = malloc(sizeof(struct passwd))) == NULL) { - tst_brkm(TBROK, cleanup, "couldn't allocate space for passwd" - " structure"); - } + struct passwd *ent = NULL; /* get the uid value for the user */ if ((ent = getpwnam(user)) == NULL) { -- 1.9.3 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list