Commit 429e6460 authored by Claudio Valerio's avatar Claudio Valerio

some leaks fixed and cosmetics changes

parent d3ca55c9
......@@ -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)
{
......
......@@ -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
}
......@@ -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");
......
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment