aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradnano <me@adnano.co>2024-05-03 19:31:11 -0400
committeradnano <me@adnano.co>2024-05-03 19:31:11 -0400
commite1816cc9a9ab7887dc2aa10b6244055546111049 (patch)
treecefb3fc8e768ecc7edb05f4bb79e38441ed0342e
parent8f19d6a8d2f34aeb4060d4374eb204b270ffbaa8 (diff)
downloadwmenu-e1816cc9a9ab7887dc2aa10b6244055546111049.tar.gz
wmenu-run: Don't overwrite PATH
-rw-r--r--wmenu-run.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wmenu-run.c b/wmenu-run.c
index cbc35a1..228edc4 100644
--- a/wmenu-run.c
+++ b/wmenu-run.c
@@ -10,7 +10,7 @@
#include "xdg-activation-v1-client-protocol.h"
static void read_items(struct menu *menu) {
- char *path = getenv("PATH");
+ char *path = strdup(getenv("PATH"));
for (char *p = strtok(path, ":"); p != NULL; p = strtok(NULL, ":")) {
DIR *dir = opendir(p);
if (dir == NULL) {
@@ -24,6 +24,7 @@ static void read_items(struct menu *menu) {
}
closedir(dir);
}
+ free(path);
}
struct executable {