Hide Forgot
Version-Release number of selected component (if applicable): curl-7.19.7-19.el6 How reproducible: 100% Steps to Reproduce: $ cd `mktemp -d` $ cp /etc/pki/tls/cert.pem cert1.pem $ cp /etc/pki/tls/cert.pem cert2.pem $ valgrind curl --capath . -so/dev/null https://bugzilla.redhat.com Actual results: LEAK SUMMARY: definitely lost: 156 bytes in 4 blocks indirectly lost: 0 bytes in 0 blocks possibly lost: 1,688,388 bytes in 6,710 blocks still reachable: 21,649 bytes in 104 blocks suppressed: 0 bytes in 0 blocks Expected results: LEAK SUMMARY: definitely lost: 836 bytes in 4 blocks indirectly lost: 208 bytes in 2 blocks possibly lost: 176 bytes in 4 blocks still reachable: 20,782 bytes in 99 blocks suppressed: 0 bytes in 0 blocks Additional info: It also prevent NSS from a proper shut down. The bug has existed there forever. The fix for bug #669702 only allowed it to cause more damage.
Created attachment 474252 [details] proposed fix Rob, could you please review the attached patch?
Comment on attachment 474252 [details] proposed fix >@@ -91,8 +92,12 @@ typedef struct { > PRInt32 version; /* protocol version valid for this cipher */ > } cipher_s; > >-#define PK11_SETATTRS(x,id,v,l) (x)->type = (id); \ >- (x)->pValue=(v); (x)->ulValueLen = (l) >+#define PK11_SETATTRS(_attr, _idx, _type, _val, _len) do { \ >+ CK_ATTRIBUTE *ptr = (_attr) + ((_idx)++); \ >+ ptr->type = (_type); \ >+ ptr->pValue = (_val); \ >+ ptr->ulValueLen = (_len); \ >+} while (0); Oops, I left there an extra semicolon ^^^. Please ignore it. It's harmless anyway.
Comment on attachment 474252 [details] proposed fix Ok, right, loading more than 1 CA would lead to leaks and failed NSS shutdown. This looks good.
Thanks for review.
pushed upstream: https://github.com/bagder/curl/commit/dc0a716
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: libcurl leaked memory and eventually resulted in a failed NSS shutdown when more than one CA certificate was loaded. This is now fixed so that libcurl works as expected when more than one CA certificates is loaded.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0573.html