Skip to content

Memory leak from strdup when proxy is enabled #32

@vikivivi

Description

@vikivivi

It seem there is a memory leak when using strdup(), the memory is not free.

https://github.com/twekkel/htpdate/blob/master/htpdate.c#L831

  • You might want to perform some checking using clang in Ubuntu 22.04.
$ wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.2/clang+llvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz
$ sudo mkdir -p /opt/llvm
$ sudo tar -C /opt/llvm --no-same-owner --owner=root --group=root -xvf clang+llvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz
$ sudo ln -sfn "clang+llvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04" /opt/llvm/clang
$ rm -f clang+llvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz
  • Perform scan-build check
$ /opt/llvm/clang/bin/scan-build -o ${PWD}/static-analysis/htpdate -k -stats -internal-stats -analyze-headers -maxloop 25 -enable-checker security.FloatLoopCounter -enable-checker security.insecureAPI.DeprecatedOrUnsafeBufferHandling make CC=clang clean https
  • View the html report using /opt/llvm/clang/bin/scan-view or web browser in directory static-analysis/htpdate

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions