Skip to content

Fixing a memory leak in knetfile.c. - #104

Open
timothy-king wants to merge 1 commit into
attractivechaos:masterfrom
timothy-king:free-size-cmd
Open

Fixing a memory leak in knetfile.c.#104
timothy-king wants to merge 1 commit into
attractivechaos:masterfrom
timothy-king:free-size-cmd

Conversation

@timothy-king

Copy link
Copy Markdown

fp->size_cmd is set to allocated memory in kftp_parse_url() but this is not freed by knet_close(). The fix should be safe in other cases as these allocate the memory of fp via calloc leaving fp->size_cmd equal to NULL by default, and free(NULL) is a nop (https://linux.die.net/man/3/free).

Adds a test that builds knetfile.c.

fp->size_cmd is set to allocated memory in kftp_parse_url() but this is not freed by knet_close(). The fix should be safe in other cases as these allocate the memory of fp via calloc leaving fp->size_cmd equal to NULL by default, and free(NULL) is a nop (https://linux.die.net/man/3/free).

Adds a test that builds knetfile.c.
@timothy-king

Copy link
Copy Markdown
Author

If the test for that builds knetfile.c is too instrusive/hackish, it can be dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant