]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp: Handle NULL environ like pointer to NULL pointer [PR111413]
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Sep 2023 07:26:35 +0000 (09:26 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 5 Dec 2023 13:11:28 +0000 (14:11 +0100)
commitc128ad8e830e90a429eaeccc3fb000a73fd6779c
tree519636a9240ccd1c58816bd8ab504fe927d6630a
parentcefca88f13e7377ab3a93b6609348205eef779c4
libgomp: Handle NULL environ like pointer to NULL pointer [PR111413]

clearenv function just sets environ to NULL (after sometimes freeing it),
rather than setting it to a pointer to NULL, and our code was assuming
it is always non-NULL.

Fixed thusly, the change seems to be large but actually is just
+  if (environ)
     for (env = environ; *env != 0; env++)
plus reindentation.  I've also noticed the block after this for loop
was badly indented (too much) and fixed that too.

No testcase added, as it needs clearenv + dlopen.

2023-09-19  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/111413
* env.c (initialize_env): Don't dereference environ if it is NULL.
Reindent.

(cherry picked from commit 15345980633c502f0486a2e40e96224f49134130)
libgomp/env.c