($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/3] lib/tst_tmpdir: Normalize user defined TMPDIR
Date: Mon, 6 May 2024 23:31:24 +0200	[thread overview]
Message-ID: <20240506213124.GA71396@pevik> (raw)
In-Reply-To: <7de3ea33-b6ea-4361-9303-a34d831ada4f@suse.cz>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-05-06 21:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 11:50 [LTP] [PATCH v2 0/3] Remove double or trailing slashes in TMPDIR in C API Petr Vorel
2024-03-25 11:50 ` [LTP] [PATCH v2 1/3] lib/tst_tmpdir: Normalize user defined TMPDIR Petr Vorel
2024-05-06 14:55   ` Martin Doucha
2024-05-06 21:31     ` Petr Vorel [this message]
2024-03-25 11:50 ` [LTP] [PATCH v2 2/3] lib: Add test for tst_tmpdir Petr Vorel
2024-03-25 11:50 ` [LTP] [PATCH v2 3/3] lib: Improve doc related to $TMPDIR default value Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506213124.GA71396@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).