$OpenBSD: patch-squashfs-tools_action_c,v 1.2 2021/05/26 19:54:24 sthen Exp $

modified from https://github.com/plougher/squashfs-tools/pull/69

Index: squashfs-tools/action.c
--- squashfs-tools/action.c.orig
+++ squashfs-tools/action.c
@@ -2284,9 +2284,12 @@ static char *get_start(char *s, int n)
 
 static int subpathname_fn(struct atom *atom, struct action_data *action_data)
 {
-	return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath),
+	char *path = strdup(action_data->subpath);
+	int is_match = fnmatch(atom->argv[0], get_start(path,
 		count_components(atom->argv[0])),
 		FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0;
+	free(path);
+	return is_match;
 }
 
 /*
