@@ -4703,9 +4703,7 @@ static char *find_datadir(const char *argv0)
char *dir;
char *p = NULL;
char *res;
-#ifdef PATH_MAX
char buf[PATH_MAX];
-#endif
size_t max_len;
#if defined(__linux__)
@@ -4730,10 +4728,7 @@ static char *find_datadir(const char *argv0)
/* If we don't have any way of figuring out the actual executable
location then try argv[0]. */
if (!p) {
-#ifdef PATH_MAX
- p = buf;
-#endif
- p = realpath(argv0, p);
+ p = realpath(argv0, buf);
if (!p) {
return NULL;
}
@@ -4752,9 +4747,7 @@ static char *find_datadir(const char *argv0)
res = NULL;
}
}
-#ifndef PATH_MAX
- free(p);
-#endif
+
return res;
}
#undef SHARE_SUFFIX
PATH_MAX is used elsewhere in the qemu source tree without protection. In addtion the actual code would not compile if PATH_MAX is not defined Last the free() call is wrong as p is not malloc()ed. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> --- vl.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)