Skip to contentSkip to conversation

cert_data: fix memory leak

PATCH In review Yegor Yefremov 3 participants 7 messages Apr 20, 2015 – May 31, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cert_data: fix memory leak

Release pCertName, if SecCertificateCopyValues() fails.

Found via cppcheck.

---
 contrib/keychain-mcd/cert_data.c | 1 +
 1 file changed, 1 insertion(+)
contrib/keychain-mcd/cert_data.c +1 -0
index f2b33ed..a04bf79 100644
@@ -146,6 +146,7 @@ CFArrayRef GetFieldsFromCertificate(SecCertificateRef certificate, CFTypeRef oid
       printErrorMsg("GetFieldsFromCertificate: SecCertificateCopyValues", error);
       CFRelease(keySelection);
       CFRelease(fields);
+      destroyCertName(pCertName);
       return NULL;
   }
   CFDictionaryRef vals = CFDictionaryGetValue(dict, oid);
Signature · 1 line
2.1.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Yegor Yefremov

Release pCertName, if SecCertificateCopyValues() fails.

Found via cppcheck.

Thank you!

Quoted 18 lines
---
 contrib/keychain-mcd/cert_data.c | 1 +
 1 file changed, 1 insertion(+)
contrib/keychain-mcd/cert_data.c +1 -0
index f2b33ed..a04bf79 100644
@@ -146,6 +146,7 @@ CFArrayRef GetFieldsFromCertificate(SecCertificateRef certificate, CFTypeRef oid
       printErrorMsg("GetFieldsFromCertificate: SecCertificateCopyValues", error);
       CFRelease(keySelection);
       CFRelease(fields);
+      destroyCertName(pCertName);
       return NULL;
   }
   CFDictionaryRef vals = CFDictionaryGetValue(dict, oid);
Signature · 1 line
2.1.0
Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#2 lore raw

Hi Gert,

Quoted 26 lines · Vasily Kulikov
Quoted 6 lines · Yegor Yefremov

Release pCertName, if SecCertificateCopyValues() fails.

Found via cppcheck.

Thank you!

Quoted 14 lines
---
 contrib/keychain-mcd/cert_data.c | 1 +
 1 file changed, 1 insertion(+)
contrib/keychain-mcd/cert_data.c +1 -0
index f2b33ed..a04bf79 100644
@@ -146,6 +146,7 @@ CFArrayRef GetFieldsFromCertificate(SecCertificateRef certificate, CFTypeRef oid
       printErrorMsg("GetFieldsFromCertificate: SecCertificateCopyValues", error);
       CFRelease(keySelection);
       CFRelease(fields);
+      destroyCertName(pCertName);
       return NULL;
Quoted 8 lines
Quoted 4 lines
contrib/keychain-mcd/cert_data.c +0 -1
   }
   CFDictionaryRef vals = CFDictionaryGetValue(dict, oid);
--

2.1.0

--
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments

Could you please take a look at this patch?

Btw. do you have a Jenkins or buildbot instance running for OpenVPN?

I'm monitoring some OSS projects with Jenkins and cppcheck plugin.

Yegor

#3 lore raw

Hi,

Quoted 10 lines · Yegor Yefremov
Quoted 9 lines · Vasily Kulikov
Quoted 6 lines · Yegor Yefremov

Release pCertName, if SecCertificateCopyValues() fails.

Found via cppcheck.

[..]

Quoted 1 line

Could you please take a look at this patch?

Looks reasonable to me, and if Vasily as the primary author acks it, fine to me. I'll merge it ASAP, though it would make my life easier if I had the original mail (on the openvpn-devel list) to feed into "git am"... :-)

Quoted 3 lines

Btw. do you have a Jenkins or buildbot instance running for OpenVPN?

I'm monitoring some OSS projects with Jenkins and cppcheck plugin.

Buildbot, yes. http://community.openvpn.net/openvpn/wiki/OpenVPN_QA

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw
Quoted 12 lines · Gert Doering

Hi,

Quoted 9 lines · Yegor Yefremov
Quoted 8 lines · Vasily Kulikov
Quoted 6 lines · Yegor Yefremov

Release pCertName, if SecCertificateCopyValues() fails.

Found via cppcheck.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

[..]

Quoted 1 line

Could you please take a look at this patch?

Looks reasonable to me, and if Vasily as the primary author acks it, fine to me. I'll merge it ASAP, though it would make my life easier if I had the original mail (on the openvpn-devel list) to feed into "git am"... :-)

Do you mean this one
http://article.gmane.org/gmane.network.openvpn.devel/9600 or should I just include you in CC next time I send a patch?

Quoted 12 lines
Quoted 3 lines

Btw. do you have a Jenkins or buildbot instance running for OpenVPN?

I'm monitoring some OSS projects with Jenkins and cppcheck plugin.

Buildbot, yes. http://community.openvpn.net/openvpn/wiki/OpenVPN_QA

gert
--
USENET is *not* the non-clickable part of WWW!

                                                           //www.muc.de/~gert/

Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...

#5 lore raw

Hi,

Quoted 8 lines · Yegor Yefremov
Quoted 4 lines

Looks reasonable to me, and if Vasily as the primary author acks it, fine to me. I'll merge it ASAP, though it would make my life easier if I had the original mail (on the openvpn-devel list) to feed into "git am"... :-)

Do you mean this one
http://article.gmane.org/gmane.network.openvpn.devel/9600 or should I just include you in CC next time I send a patch?

Ouch. Sorry, overlooked that one - yes, that is what I had in mind, patch on list (and preferrably, ACK on list as well :-) ).

And occasional poking if nothing happens. Apologies.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#6 lore raw
In reply to Yegor Yefremov

Your patch has been applied to the master branch.

Apologies for overlooking patch and ACK on the list - dunno what happened, I just saved both mails to my "done!" folder, without actually merging... (which might explain my somewhat confused replies later, sorry again)

commit 7d30696ac51aa9649f2290ada2c0fb5865cfe859 (master)

Author: Yegor Yefremov
Date:   Mon Apr 20 16:30:56 2015 +0200
     cert_data: fix memory leak

     Signed-off-by: Yegor Yefremov <[email protected]...>
     Acked-by: Vasily Kulikov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9600
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering