Conversation
mspncp
left a comment
There was a problem hiding this comment.
From the asan callstack it looks like this is the fix for @paulidale's memory leak. Could you please also revert his workaround 64827f4?
|
And, while your at it, maybe you also want to fix this coverity issue? |
|
Approval includes coverity fix (removal of line 534) |
|
Nice work @slontis. I don't understand how my "fix" fixed anything. |
cc796ed to
de1bc5e
Compare
|
Short answer - it didnt :). |
|
The way the fetch works is very hard to follow.. |
|
The fix looks okay. I still don't know what I was seeing -- it showed up as a leak in |
They share the same RAND object since the ref count just gets incremented - it just shows up in RAND_get0_primary(0 as that was the first to allocate.. it isnt the one that incremented the refcount and then did not decrement it. What I was seeing was a refcount of 2 after the setup for the CTR_DRBG.. Then it got incremented 3*2 times during the test.. Which was then decremented 3 times at the end of the test followed by a decrement of 2 on shutdown.. leaving a count of 3 which is the leak. |
Indeed, the leak is unrelated to |
|
Is this an urgent fix? |
|
It fixes a CI failure on master, so yes, it qualifies as 'urgent'. Sorry for not stating it explicitly, I thought my agreement was implied by setting the state to 'ready to merge'. |
Reviewed-by: Matthias St. Pierre <[email protected]> (Merged from #12613)
|
I think it doesnt hurt to state it explicitly. (i.e. Share the blame when it goes wrong :)) |
|
Thanks.. Merged to master. |
Reviewed-by: Matthias St. Pierre <[email protected]> (Merged from openssl#12613)
Valgrind showed that the second test contains a memory leak.
new_drbg() increased the ref count for the CTR_DRBG for both the EVP_RAND_fetch() and EVP_RAND_CTX_new().
it was then only decremented once by the EVP_RAND_CTX_free().
Checklist