[Pkg-owncloud-commits] [owncloud-client] 36/78: Fix pot. mem leak found by coverity (CID 96004)

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Jun 24 16:29:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit c041ca616357631456da6696d533ab029dd573fc
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Tue May 24 11:21:25 2016 +0200

    Fix pot. mem leak found by coverity (CID 96004)
---
 src/3rdparty/certificates/p12topem.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/3rdparty/certificates/p12topem.cpp b/src/3rdparty/certificates/p12topem.cpp
index 75e736a..bf6a83c 100644
--- a/src/3rdparty/certificates/p12topem.cpp
+++ b/src/3rdparty/certificates/p12topem.cpp
@@ -28,16 +28,12 @@
  * \return string PEM
  */
 string x509ToString(BIO *o) {
-    int len = 0;
     BUF_MEM *bptr;
-    void* data;
-    string ret = "";
-    
     BIO_get_mem_ptr(o, &bptr);
-    len = bptr->length;
-    data = calloc(len+10, sizeof(char));
+    int len = bptr->length;
+    void* data = calloc(len+10, sizeof(char));
     BIO_read(o, data, len);
-    ret = strdup((char*)data);
+    string ret = std::string(static_cast<char*>(data));
     free(data);
         
     return ret;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list