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

Memory leak in CompressClipData #647

Closed
jonathanpoelen opened this issue Feb 4, 2025 · 2 comments
Closed

Memory leak in CompressClipData #647

jonathanpoelen opened this issue Feb 4, 2025 · 2 comments
Labels

Comments

@jonathanpoelen
Copy link
Contributor

The zip stream in CompressClipData is allocated, but never freed.

static int
CompressClipData(Bytef *dest, uLongf *destLen, Bytef *source, uLong sourceLen)
{
  int ret;
  z_stream *zs = (z_stream*)malloc(sizeof(z_stream));
  // [...]
  // nerver free(zs);
  // [...]
  return ret;
}

The z_stream pointer should not be a pointer and the rest of the function modified accordingly.

@bk138
Copy link
Member

bk138 commented Feb 5, 2025

True. Happy about a PR :-)

@jonathanpoelen
Copy link
Contributor Author

I'll do it tomorrow or the day after if I think of it, but I was originally looking for a way to implement file transfer. As I couldn't find it, I went for ultravnc.

You should add static analysis tools like sonar or clang-tidy to your CI. Without any other dependencies, gcc's -fanalyzer works pretty well for C.

jonathanpoelen added a commit to jonathanpoelen/libvncserver that referenced this issue Feb 6, 2025
@bk138 bk138 closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants