Commit ea64dc9a authored by Timur Pocheptsov's avatar Timur Pocheptsov Committed by Joerg Bornemann
Browse files

qlockfile_unix - code cleanup


Coverity's CID 157687: QCache::insert, indeed, can delete (immediately)
the object we're trying to insert. While this never happens actually in
qlockfile_unix since we have max cost 10 and insert with cost 1, the
code does not look good and Coverity is not happy.

Change-Id: I16a428017bf86e151afe5256906e4cab1ef4044a
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent eb786d60
No related merge requests found
Showing with 7 additions and 5 deletions
...@@ -139,12 +139,14 @@ static bool fcntlWorksAfterFlock(const QString &fn) ...@@ -139,12 +139,14 @@ static bool fcntlWorksAfterFlock(const QString &fn)
if (fcntlOK.isDestroyed()) if (fcntlOK.isDestroyed())
return QLockFilePrivate::checkFcntlWorksAfterFlock(fn); return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
bool *worksPtr = fcntlOK->object(fn); bool *worksPtr = fcntlOK->object(fn);
if (!worksPtr) { if (worksPtr)
worksPtr = new bool(QLockFilePrivate::checkFcntlWorksAfterFlock(fn)); return *worksPtr;
fcntlOK->insert(fn, worksPtr);
} const bool val = QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
worksPtr = new bool(val);
fcntlOK->insert(fn, worksPtr);
return *worksPtr; return val;
} }
static bool setNativeLocks(const QString &fileName, int fd) static bool setNativeLocks(const QString &fileName, int fd)
......
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