From 97bb5b2b6dda6cafb723ecf0701c1499ac06097c Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 22 Jan 2018 17:05:52 +0530 Subject: [PATCH 1/2] added a check to avoid freeing null pointer --- src/newusers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/newusers.c b/src/newusers.c index c38aec4b..664313fc 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -290,6 +290,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) fprintf (stderr, _("%s: invalid group name '%s'\n"), Prog, grent.gr_name); + if (grent.gr_name) free (grent.gr_name); return -1; } From bb47fdf25e5a4272c25935ff2c45657c20bfec6e Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 22 Jan 2018 17:07:27 +0530 Subject: [PATCH 2/2] indentation fix --- src/newusers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newusers.c b/src/newusers.c index 664313fc..ac80f548 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -291,7 +291,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) _("%s: invalid group name '%s'\n"), Prog, grent.gr_name); if (grent.gr_name) - free (grent.gr_name); + free (grent.gr_name); return -1; }