diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp
index 73a81c5b..56b4890e 100644
--- a/src/adaptors/UBCFFSubsetAdaptor.cpp
+++ b/src/adaptors/UBCFFSubsetAdaptor.cpp
@@ -1215,13 +1215,17 @@ UBGraphicsGroupContainerItem *UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGro
                 pStrokesGroup->addToGroup(poly);
             }
         }
-        if (currentStroke->polygons().empty())
+        if (currentStroke->polygons().empty()){
             delete currentStroke;
+            currentStroke = NULL;
+        }
 
         if (pStrokesGroup->childItems().count())
             mCurrentScene->addItem(pStrokesGroup);
-        else
+        else{
             delete pStrokesGroup;
+            pStrokesGroup = NULL;
+        }
 
         if (pStrokesGroup)
         {
diff --git a/src/adaptors/UBExportCFF.cpp b/src/adaptors/UBExportCFF.cpp
index 3d3b94c9..ee78796c 100644
--- a/src/adaptors/UBExportCFF.cpp
+++ b/src/adaptors/UBExportCFF.cpp
@@ -51,10 +51,10 @@ QString UBExportCFF::exportExtention()
 
 void UBExportCFF::persist(UBDocumentProxy* pDocument)
 {
-    QString src = pDocument->persistencePath();
-
     if (!pDocument)
         return;
+    
+    QString src = pDocument->persistencePath();
 
     QString filename = askForFileName(pDocument, tr("Export as IWB File"));
 
@@ -82,4 +82,4 @@ void UBExportCFF::persist(UBDocumentProxy* pDocument)
     }
 
     
-}
\ No newline at end of file
+}
diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp
index 546c6ed0..9af8626b 100644
--- a/src/adaptors/UBSvgSubsetAdaptor.cpp
+++ b/src/adaptors/UBSvgSubsetAdaptor.cpp
@@ -1553,7 +1553,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgPolygon(UBGraphicsPo
     QPolygonF polygon = polygonItem->polygon();
     int pointsCount = polygon.size();
 
-    if (polygonItem && pointsCount > 0)
+    if (pointsCount > 0)
     {
         mXmlWriter.writeStartElement("polygon");
 
diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp
index 17b4dd28..b1d6545e 100644
--- a/src/domain/UBGraphicsTextItemDelegate.cpp
+++ b/src/domain/UBGraphicsTextItemDelegate.cpp
@@ -132,7 +132,7 @@ void UBGraphicsTextItemDelegate::customize(QFontDialog &fontDialog)
         fontDialog.setStyleSheet("background-color: white;");
     }
 
-    QListView *fontNameListView;
+    QListView *fontNameListView = NULL;
     QList<QListView*> listViews = fontDialog.findChildren<QListView*>();
     if (listViews.count() > 0)
     {
diff --git a/src/frameworks/UBCryptoUtils.cpp b/src/frameworks/UBCryptoUtils.cpp
index b5df8ccd..ea6b46f2 100644
--- a/src/frameworks/UBCryptoUtils.cpp
+++ b/src/frameworks/UBCryptoUtils.cpp
@@ -68,15 +68,21 @@ QString UBCryptoUtils::symetricEncrypt(const QString& clear)
     int paddingLength = 0;
     unsigned char *ciphertext = (unsigned char *)malloc(cipheredLength);
 
-    if(!EVP_EncryptInit_ex(&mAesEncryptContext, NULL, NULL, NULL, NULL))
+    if(!EVP_EncryptInit_ex(&mAesEncryptContext, NULL, NULL, NULL, NULL)){
+        free(ciphertext);
         return QString();
+    }
 
-    if(!EVP_EncryptUpdate(&mAesEncryptContext, ciphertext, &cipheredLength, (unsigned char *)clearData.data(), clearData.length()))
+    if(!EVP_EncryptUpdate(&mAesEncryptContext, ciphertext, &cipheredLength, (unsigned char *)clearData.data(), clearData.length())){
+        free(ciphertext);
         return QString();
+    }
 
     /* update ciphertext with the final remaining bytes */
-    if(!EVP_EncryptFinal_ex(&mAesEncryptContext, ciphertext + cipheredLength, &paddingLength))
+    if(!EVP_EncryptFinal_ex(&mAesEncryptContext, ciphertext + cipheredLength, &paddingLength)){
+        free(ciphertext);
         return QString();
+    }
 
     QByteArray cipheredData((const char *)ciphertext, cipheredLength + paddingLength);
 
@@ -94,14 +100,20 @@ QString UBCryptoUtils::symetricDecrypt(const QString& encrypted)
     int paddingLength = 0;
     unsigned char *plaintext = (unsigned char *)malloc(encryptedLength);
 
-    if(!EVP_DecryptInit_ex(&mAesDecryptContext, NULL, NULL, NULL, NULL))
+    if(!EVP_DecryptInit_ex(&mAesDecryptContext, NULL, NULL, NULL, NULL)){
+        free(plaintext);
         return QString();
+    }
 
-    if(!EVP_DecryptUpdate(&mAesDecryptContext, plaintext, &encryptedLength, (const unsigned char *)encryptedData.data(), encryptedData.length()))
+    if(!EVP_DecryptUpdate(&mAesDecryptContext, plaintext, &encryptedLength, (const unsigned char *)encryptedData.data(), encryptedData.length())){
+        free(plaintext);
         return QString();
+    }
 
-    if(!EVP_DecryptFinal_ex(&mAesDecryptContext, plaintext + encryptedLength, &paddingLength))
+    if(!EVP_DecryptFinal_ex(&mAesDecryptContext, plaintext + encryptedLength, &paddingLength)){
+        free(plaintext);
         return QString();
+    }
 
     int len = encryptedLength + paddingLength;
     QByteArray clearData((const char *)plaintext, len);