c9s / r3

libr3 is a high-performance path dispatching library. It compiles your route paths into a prefix tree (trie). By using the constructed prefix trie in the start-up time, you may dispatch your routes with efficiency
http://c9s.github.com/r3/bench.html
MIT License
815 stars 83 forks source link

Fix leak in r3_tree_insert_pathl_ex() #150

Closed bjosv closed 2 years ago

bjosv commented 2 years ago

Includes a testcase triggering the issue when building with the leak sanitizer.

Fixes Resource leak (CID 355063) found by Coverity.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+1.2%) to 91.455% when pulling 2068aafd857a2e4ebb05da00443fba2fca60208f on Nordix:fix-coverity-issue into 25cc816025850c9221ed9b854e774dfa88a58088 on c9s:2.0.

bjosv commented 2 years ago

Strange that the Coverity run succeded once only, according to https://scan.coverity.com/faq it should freely handle:

The number of weekly builds per project are as follows:
Up to 28 builds per week, with a maximum of 4 builds per day, for projects with fewer than 100K lines of code.

Will retrigger this run tomorrow and hopefully there is an inital problem only. Otherwise we might need to put this CI step as an optional/informational step only.

c9s commented 2 years ago

wow! so fast!!

c9s commented 2 years ago

Perhaps you need to configure the pull_request event https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#using-a-single-event

bjosv commented 2 years ago

Perhaps you need to configure the pull_request event https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#using-a-single-event

We get an attempt to run Coverity, so the trigger seems to be ok via: https://github.com/c9s/r3/blob/edbeb0631d615a7751d20d5f11a3a8959d5facb6/.github/workflows/coverity.yml#L2

When I tried to run the following download step manually (with COVERITY_TOKEN replaced with correct token) it seems to work. https://github.com/c9s/r3/blob/edbeb0631d615a7751d20d5f11a3a8959d5facb6/.github/workflows/coverity.yml#L14

but when running with a slightly changed token, i.e a faulty one, I get the same error code as in the CI job. Error code 6 means "Username/password authentication failure." for wget.

> wget -q https://scan.coverity.com/download/linux64 --post-data "token=w..<mod>..w&project=r3" -O coverity-linux64.tgz
> echo $?                                                                                                                          
6

I wonder if a space or something else sneaked in when you added the Coverity project token in the Github secret COVERITY_TOKEN?

Maybe you could try to regenerate the token in https://scan.coverity.com/projects/r3?tab=project_settings token and then update the Github secret with this new value?

Still strange it worked once, but I'm out of ideas otherwise..

c9s commented 2 years ago

let me check

bjosv commented 2 years ago

CI green on default branch after merged. Thanks for the help.