|
Message-ID: <CAND4rFaJyy4qEooADYHjFj3yF3wQaQ02GCX3u13_OJGOr1hu+w@mail.gmail.com>
Date: Wed, 17 Jul 2024 18:54:59 +0200
From: Luca <groovysnail42@...il.com>
To: musl@...ts.openwall.com
Subject: Memory Leak
Hi,
I believe I found a memory leak in your code.
In the file: /src/env/putenv.c
In the function: int __putenv(char *s, size_t l, char *r);
The variable `static char **oldenv` is passed to a free in line 29:
`free(oldenv);`.
The variable is a 2d pointer and therefore all contents within it should be
freed.
By freeing only oldenv all the lines of `__environ` are lost.
Possible hotfix:
```
for (int j = 0; oldenv[j]; ++j) free(oldenv[j]);
free(oldenv);
```
Thank you for your support and dedication,
Luca
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.