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