From: Daniel Molkentin Date: Tue, 24 May 2016 09:21:25 +0000 (+0200) Subject: Fix pot. mem leak found by coverity (CID 96004) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1167^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c041ca616357631456da6696d533ab029dd573fc;p=nextcloud-desktop.git Fix pot. mem leak found by coverity (CID 96004) --- diff --git a/src/3rdparty/certificates/p12topem.cpp b/src/3rdparty/certificates/p12topem.cpp index 75e736a7a..bf6a83c4e 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(data)); free(data); return ret;