Fix svace defect 33/78533/1 accepted/tizen/common/20160706.142240 accepted/tizen/ivi/20160706.082720 accepted/tizen/mobile/20160706.082628 accepted/tizen/tv/20160706.082622 accepted/tizen/wearable/20160706.082612 submit/tizen/20160706.042052
authorKyungwook Tak <k.tak@samsung.com>
Wed, 6 Jul 2016 04:00:55 +0000 (13:00 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Wed, 6 Jul 2016 04:00:55 +0000 (13:00 +0900)
wgid: 30891, 99720

Change-Id: I2ae5ea6c4d8f08fbc7737f677794705af16aba17
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
vcore/vcore/Client.cpp
vcore/vcore/api.cpp

index cdb1954..6767ca8 100644 (file)
@@ -68,12 +68,10 @@ void initialize_req_data(VcoreRequestData *pData)
 
 CertSvcStoreCertList *createStoreListNode(VcoreCertResponseData *cert)
 {
-       CertSvcStoreCertList *node = NULL;
-
-       if (cert == NULL || cert->gname == NULL || cert->title == NULL)
+       if (cert == NULL)
                return NULL;
 
-       node = (CertSvcStoreCertList *)malloc(sizeof(CertSvcStoreCertList));
+       CertSvcStoreCertList *node = (CertSvcStoreCertList *)malloc(sizeof(CertSvcStoreCertList));
 
        if (node == NULL)
                return NULL;
index 902aa8c..6d125bf 100644 (file)
@@ -1610,7 +1610,6 @@ int certsvc_get_certificate(CertSvcInstance instance,
                        if (fwrite(certBuffer, sizeof(char), length, fp_write) != length) {
                                LogError("Fail to write certificate.");
                                result = CERTSVC_FAIL;
-                               fclose(fp_write);
                                goto error;
                        }
 
@@ -1618,24 +1617,26 @@ int certsvc_get_certificate(CertSvcInstance instance,
 
                        if (result != CERTSVC_SUCCESS) {
                                LogError("Failed to construct certificate from buffer.");
-                               fclose(fp_write);
                                goto error;
                        }
 
-                       fclose(fp_write);
                        unlink(fileName.c_str());
                }
 
                result = CERTSVC_SUCCESS;
        } catch (std::bad_alloc &) {
-               return CERTSVC_BAD_ALLOC;
+               result = CERTSVC_BAD_ALLOC;
        } catch (...) {}
 
 error:
+       if (x509Struct)
+               X509_free(x509Struct);
 
-       if (x509Struct) X509_free(x509Struct);
+       if (pBio)
+               BIO_free(pBio);
 
-       if (pBio) BIO_free(pBio);
+       if (fp_write)
+               fclose(fp_write);
 
        return result;
 }