[LTP] [PATCH v2 1/3] lib/tst_tmpdir: Normalize user defined TMPDIR

Petr Vorel pvorel@suse.cz
Mon May 6 23:31:24 CEST 2024


Hi Martin,

> Hi,
> I don't like the approach of directly modifying the process environment.
> Also, if TMPDIR variable is not set, the newly added strdup() will lead to a
> memory leak because the function is called multiple times.

> I recommend adding a static pointer that'll hold the cleaned up path and the
> string cleanup will run only once on the first call. Then the pointer will
> be free()d during library cleanup.

Good, point, thanks!

Kind regards,
Petr


More information about the ltp mailing list