Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible memory leak with sessions #25

Closed
LeSpocky opened this issue May 10, 2016 · 2 comments · Fixed by #44
Closed

possible memory leak with sessions #25

LeSpocky opened this issue May 10, 2016 · 2 comments · Fixed by #44

Comments

@LeSpocky
Copy link
Collaborator

The global variable sess_fname is a pointer to dynamically allocated memory which happens either in sess_generate_id() or in cgi_session_start(). However this memory is never freed.

@LeSpocky LeSpocky added the bug label May 10, 2016
@LeSpocky LeSpocky added this to the v1.1 milestone May 10, 2016
@LeSpocky LeSpocky self-assigned this May 10, 2016
@LeSpocky
Copy link
Collaborator Author

This is not easy to solve. sess_fname is currently a static variable in session.c and the only API function exposed in the headers which could do this is cgi_end() which is implemented in cgi.c.

Exposing the variable globally: bad. Exposing the variable to cgi.c only: not possible without exposing it globally (?).

This whole concept of global variables in a library is broken, but for v1.x we can't change it anymore, if we want to maintain API compatibility.

I propose adding a new function like cgi_session_free() which does the cleanup.

@LeSpocky LeSpocky modified the milestones: v1.1.1, v1.1 May 18, 2016
@LeSpocky LeSpocky modified the milestones: v1.2, v1.1.1 Feb 16, 2017
@LeSpocky
Copy link
Collaborator Author

Moved this to milestone v1.2, because introducing a new function would extend the API which would trigger a minor version bump with semantic versioning.

@LeSpocky LeSpocky added the api label Feb 16, 2017
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Feb 16, 2017
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Feb 16, 2017
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Feb 16, 2017
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Feb 16, 2017
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Feb 16, 2017
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
@LeSpocky LeSpocky mentioned this issue Jul 12, 2018
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

fixes rafaelsteil#25

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This fixes a possible memory leak when working with sessions (especially
with some non-mainline fcgi patches). Quoting from the ticket:

The global variable `sess_fname` is a pointer to dynamically allocated
memory which happens either in `sess_generate_id()` or in
`cgi_session_start()`. However this memory is never freed.

To not expose the variable globally or even just to `cgi.c` where e.g.
`cgi_end()` could access it, a new API function is introduced. We leave
bumping the API version up to a follow up commit.

Fixes: rafaelsteil#25
Signed-off-by: Alexander Dahl <post@lespocky.de>
LeSpocky added a commit to LeSpocky/libcgi that referenced this issue Jul 12, 2018
This is a follow-up to rafaelsteil#25 to ensure this all works like it should
without evil memory leaks, null pointer dereferences, …

Now the first test here is very simple, just to get this test module
running.

Signed-off-by: Alexander Dahl <post@lespocky.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant