summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2009-10-16 20:03:18 +0000
committerHisham Muhammad <hisham@gobolinux.org>2009-10-16 20:03:18 +0000
commit1e124da059cb21cb85e824e4f35ba222c96e29bd (patch)
tree9fe0cc3317f2dad33b9d36944769026817a5cb8b
parentdd86b9b646ecfd795616fa2ca6ec9c054aa0b98b (diff)
coverity fixes
-rw-r--r--ProcessList.c4
-rw-r--r--UptimeMeter.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 24e08104..dea1844e 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -313,7 +313,7 @@ static void ProcessList_remove(ProcessList* this, Process* p) {
unsigned int pid = p->pid;
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
assert(index != -1);
- Vector_remove(this->processes, index);
+ if (index >= 0) Vector_remove(this->processes, index);
assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
}
@@ -730,7 +730,7 @@ static bool ProcessList_processEntries(ProcessList* this, char* dirname, Process
void ProcessList_scan(ProcessList* this) {
unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
- unsigned long long int swapFree;
+ unsigned long long int swapFree = 0;
FILE* status;
char buffer[128];
diff --git a/UptimeMeter.c b/UptimeMeter.c
index 0e716539..6bdf30f6 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -19,7 +19,7 @@ int UptimeMeter_attributes[] = {
};
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
- double uptime;
+ double uptime = 0;
FILE* fd = fopen(PROCDIR "/uptime", "r");
fscanf(fd, "%lf", &uptime);
fclose(fd);

© 2014-2024 Faster IT GmbH | imprint | privacy policy