From: Karel Zak Date: Mon, 6 Feb 2012 10:22:54 +0000 (+0100) Subject: vipw: use xalloc.h X-Git-Tag: v2.21-rc2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23925360bb2672b9f2a8e3afc118e5cbe43cb001;p=thirdparty%2Futil-linux.git vipw: use xalloc.h Signed-off-by: Karel Zak --- diff --git a/login-utils/vipw.c b/login-utils/vipw.c index 1926db8c81..92b42313f3 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -65,6 +65,7 @@ #include "nls.h" #include "setpwnam.h" #include "strutils.h" +#include "xalloc.h" #ifdef HAVE_LIBSELINUX # include @@ -218,7 +219,7 @@ static void pw_edit(int notsetuid) char *p, *editor, *tk; editor = getenv("EDITOR"); - editor = strdup(editor ? editor : _PATH_VI); + editor = xstrdup(editor ? editor : _PATH_VI); tk = strtok(editor, " \t"); if (tk && (p = strrchr(tk, '/')) != NULL) @@ -251,6 +252,8 @@ static void pw_edit(int notsetuid) } if (pid == -1 || !WIFEXITED(pstat) || WEXITSTATUS(pstat) != 0) pw_error(editor, 1, 1); + + free(editor); } void pw_error(char *name, int err, int eval)