[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace/KDE/4.8] libs/ksysguard/processcore: Fix crash when a process disappears while readyi
From:       John Tapsell <johnflux () gmail ! com>
Date:       2012-06-15 15:24:39
Message-ID: 20120615152439.82754A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit fd602e331078246fd441774d6fd3083d0ffb0ac8 by John Tapsell.
Committed on 15/06/2012 at 17:23.
Pushed by johnflux into branch 'KDE/4.8'.

Fix crash when a process disappears while readying stat information

M  +4    -0    libs/ksysguard/processcore/processes_linux_p.cpp

http://commits.kde.org/kde-workspace/fd602e331078246fd441774d6fd3083d0ffb0ac8

diff --git a/libs/ksysguard/processcore/processes_linux_p.cpp \
b/libs/ksysguard/processcore/processes_linux_p.cpp index 58bfd93..65b8dfd 100644
--- a/libs/ksysguard/processcore/processes_linux_p.cpp
+++ b/libs/ksysguard/processcore/processes_linux_p.cpp
@@ -201,6 +201,8 @@ long ProcessesLocal::getParentPid(long pid) {
     //The command name is the second parameter, and this ends with a closing \
bracket.  So find the last  //closing bracket and start from there
     word = strrchr(word, ')');
+    if (!word)
+        return -1;
     word++; //Nove to the space after the last ")"
     int current_word = 1;
 
@@ -238,6 +240,8 @@ bool ProcessesLocal::Private::readProcStat(const QString &dir, \
                Process *ps)
     //The command name is the second parameter, and this ends with a closing \
bracket.  So find the last  //closing bracket and start from there
     word = strrchr(word, ')');
+    if (!word)
+        return false;
     word++; //Nove to the space after the last ")"
     int current_word = 1; //We've skipped the process ID and now at the end of the \
command name  char status='\0';


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic