From 8402479e16453b659fe3cbf5719f47f241f87e3f Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Thu, 18 Mar 2010 00:02:17 +0000 Subject: [PATCH] * lib/tcbfuncs.c: Do not free path before its last use. --- ChangeLog | 1 + lib/tcbfuncs.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6951d965..78b3f62d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ * lib/tcbfuncs.c: Avoid implicit conversion of pointers or integers to booleans. * lib/tcbfuncs.c: Avoid assignments in comparisons. + * lib/tcbfuncs.c: Do not free path before its last use. 2010-03-17 Nicolas François diff --git a/lib/tcbfuncs.c b/lib/tcbfuncs.c index 2c00a3a3..9afe6468 100644 --- a/lib/tcbfuncs.c +++ b/lib/tcbfuncs.c @@ -126,11 +126,12 @@ static char *shadowtcb_path_rel_existing(const char *name) return NULL; } ret = readlink(path, link, sizeof(link) - 1); - free(path); if (ret == -1) { fprintf(stderr, _("%s: Cannot read symbolic link %s: %s\n"), Prog, path, strerror(errno)); + free(path); return NULL; } + free(path); if (ret >= sizeof(link) - 1) { link[sizeof(link) - 1] = '\0'; fprintf(stderr, _("%s: Suspiciously long symlink: %s\n"), Prog, link);