From: Michal Sekletar Date: Thu, 13 Dec 2012 13:59:39 +0000 (+0100) Subject: path-util: set pointer to null after calling free() X-Git-Tag: v197~122 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;ds=sidebyside;h=c9c7aef24f9750bbd51d2c13beff66473d96bf3c;p=elogind.git path-util: set pointer to null after calling free() In cases where path_strv_canonicalize() returns NULL, strv_free() is called afterwards and it will call free() on pointers which were freed already in path_strv_canonicalize() --- diff --git a/src/shared/path-util.c b/src/shared/path-util.c index 70c8a8af0..dd12d3d63 100644 --- a/src/shared/path-util.c +++ b/src/shared/path-util.c @@ -181,6 +181,7 @@ char **path_strv_canonicalize(char **l) { t = path_make_absolute_cwd(*s); free(*s); + *s = NULL; if (!t) { enomem = true;