修复inotify-watch内存泄漏;修复部分Fortify检测代码问题;
This commit is contained in:
parent
426ced314d
commit
4d498eee0b
|
@ -249,8 +249,8 @@ void InotifyWatch::run()
|
|||
if(i < len ) {
|
||||
qDebug() << "fork";
|
||||
slotEvent(buf, len);
|
||||
free(buf);
|
||||
}
|
||||
free(buf);
|
||||
--FileUtils::indexStatus;
|
||||
} else if(rc < 0) {
|
||||
// error
|
||||
|
@ -412,6 +412,7 @@ void InotifyWatch::eventProcess(int socket)
|
|||
}
|
||||
if(i >= len) {
|
||||
qDebug() << "There is nothing to do!";
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
eventProcess(buffer, len);
|
||||
|
|
|
@ -4486,7 +4486,7 @@ static ULONG ulReadLong(FILE *pFile, ULONG ulOffset) {
|
|||
UCHAR aucBytes[4];
|
||||
|
||||
if(!bReadBytes(aucBytes, 4, ulOffset, pFile)) {
|
||||
return -1;
|
||||
return ULONG_MAX;
|
||||
}
|
||||
return ulGetLong(0, aucBytes);
|
||||
} /* end of ulReadLong */
|
||||
|
|
|
@ -42,7 +42,7 @@ QString ConvertWinidToDesktop::tranIdToDesktop(WId id)
|
|||
|
||||
QString ConvertWinidToDesktop::confirmDesktopFile(KWindowInfo info)
|
||||
{
|
||||
QString desktopFilePath = nullptr;
|
||||
QString desktopFilePath = QString();
|
||||
QDir dir = QDir(DESKTOP_FILE_PATH);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
//跳过 ./ 和 ../ 目录
|
||||
|
@ -117,7 +117,7 @@ QString ConvertWinidToDesktop::searchAndroidApp(KWindowInfo info)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString ConvertWinidToDesktop::searchFromEnviron(KWindowInfo info, QFileInfoList list)
|
||||
|
@ -128,7 +128,7 @@ QString ConvertWinidToDesktop::searchFromEnviron(KWindowInfo info, QFileInfoList
|
|||
file.close();
|
||||
QList<QByteArray> list_BA = BA.split('\0');
|
||||
|
||||
QString desktopFilePath = nullptr;
|
||||
QString desktopFilePath = QString();
|
||||
for (int i = 0; i < list_BA.length(); i++) {
|
||||
if (list_BA.at(i).startsWith("GIO_LAUNCHED_DESKTOP_FILE=")) {
|
||||
desktopFilePath = list_BA.at(i);
|
||||
|
@ -165,7 +165,7 @@ QString ConvertWinidToDesktop::compareClassName(QFileInfoList list)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString ConvertWinidToDesktop::compareCmdExec(QFileInfoList list)
|
||||
|
@ -193,7 +193,7 @@ QString ConvertWinidToDesktop::compareCmdExec(QFileInfoList list)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
//最后的匹配策略汇总
|
||||
|
@ -230,7 +230,7 @@ QString ConvertWinidToDesktop::compareCmdName(QFileInfoList list)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString ConvertWinidToDesktop::compareDesktopClass(QFileInfoList list)
|
||||
|
@ -251,7 +251,7 @@ QString ConvertWinidToDesktop::compareDesktopClass(QFileInfoList list)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString ConvertWinidToDesktop::containsName(QFileInfoList list)
|
||||
|
@ -275,7 +275,7 @@ QString ConvertWinidToDesktop::containsName(QFileInfoList list)
|
|||
return fileInfo.filePath();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return QString();
|
||||
}
|
||||
|
||||
//执行头文件中宏定义写好的终端指令获取对应的Exec字段
|
||||
|
|
|
@ -57,10 +57,10 @@ private:
|
|||
ConvertWinidToDesktop& operator =(const ConvertWinidToDesktop&) = delete;
|
||||
~ConvertWinidToDesktop();
|
||||
|
||||
QString m_classClass = nullptr;
|
||||
QString m_className = nullptr;
|
||||
QString m_statusName = nullptr;
|
||||
QString m_cmdLine = nullptr;
|
||||
QString m_classClass = QString();
|
||||
QString m_className = QString();
|
||||
QString m_statusName = QString();
|
||||
QString m_cmdLine = QString();
|
||||
|
||||
QString confirmDesktopFile(KWindowInfo info);
|
||||
QString searchFromEnviron(KWindowInfo info, QFileInfoList list);
|
||||
|
|
|
@ -79,8 +79,9 @@ void DirWatcher::handleIndexItemAppend(const QString &path, QStringList &blackLi
|
|||
|
||||
//处理添加路径非根目录时,要添加索引的路径与已索引路径为父子关系的情况
|
||||
if (path != "/") {
|
||||
QString indexablePath;
|
||||
for (int i = 0; i < m_indexableDirList.length(); i++) {
|
||||
const QString indexablePath = m_indexableDirList.at(i);
|
||||
indexablePath = m_indexableDirList.at(i);
|
||||
if (path.startsWith(indexablePath + "/")) {
|
||||
qCritical() << QString("The parent of the path:%1 has been added.").arg(path);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue