action: in eval_XXX_action() functions strdup (sub-)pathname

The strings that are passed back by the (sub-)pathname
functions are over-written every time another call is
made to these functions.  This is deliberate to avoid
allocating and freeing the strings everytime on functions
which are called frequently, *and* the returned value is
only needed temporarily.  Only rarely is the string kept
long term and then the principle is the string should be
strdupped then.

The action usage of these string values without strdupping
has always been a bit edgy - on the one hand the action code
does *not* call back into the Mksquashfs mainloop which is
where the additional use of (sub-)pathname is expected to be,
on the other hand such long term reliance on strings not
being reused is prone to break with code changes.

Such a thing has happened here in the actions code - we have
introduced a new "follow_link()" test function which needs
to compute it's own action_data structure using, you guessed it,
(sub-)pathname.

So the actions code can now call (sub-)pathname whilst relying
on the previous value.  So, we need to strdup and free it.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
1 file changed