diff --git a/src/quirks.c b/src/quirks.c index a65ce4fb..8b400fb7 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "libinput-versionsort.h" #include "libinput-util.h" @@ -413,7 +414,9 @@ section_new(const char *path, const char *name) { struct section *s = zalloc(sizeof(*s)); - xasprintf(&s->name, "%s (%s)", name, basename(path)); + char *path_dup = safe_strdup(path); + xasprintf(&s->name, "%s (%s)", name, basename(path_dup)); + free(path_dup); list_init(&s->link); list_init(&s->properties);