Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
8adc7ac0
Commit
8adc7ac0
authored
Nov 08, 2006
by
Hisham Muhammad
Browse files
Fix asserts, don't use freed memory.
parent
27131192
Changes
1
Show whitespace changes
Inline
Side-by-side
ProcessList.c
View file @
8adc7ac0
...
@@ -309,12 +309,12 @@ void ProcessList_remove(ProcessList* this, Process* p) {
...
@@ -309,12 +309,12 @@ void ProcessList_remove(ProcessList* this, Process* p) {
assert
(
Vector_indexOf
(
this
->
processes
,
p
,
Process_pidCompare
)
!=
-
1
);
assert
(
Vector_indexOf
(
this
->
processes
,
p
,
Process_pidCompare
)
!=
-
1
);
assert
(
Hashtable_get
(
this
->
processTable
,
p
->
pid
)
!=
NULL
);
assert
(
Hashtable_get
(
this
->
processTable
,
p
->
pid
)
!=
NULL
);
Process
*
pp
=
Hashtable_remove
(
this
->
processTable
,
p
->
pid
);
Process
*
pp
=
Hashtable_remove
(
this
->
processTable
,
p
->
pid
);
assert
(
pp
==
p
);
assert
(
pp
==
p
);
(
void
)
pp
;
int
pid
=
p
->
pid
;
int
index
=
Vector_indexOf
(
this
->
processes
,
p
,
Process_pidCompare
);
int
index
=
Vector_indexOf
(
this
->
processes
,
p
,
Process_pidCompare
);
assert
(
index
!=
-
1
);
assert
(
index
!=
-
1
);
Vector_remove
(
this
->
processes
,
index
);
Vector_remove
(
this
->
processes
,
index
);
assert
(
Vector_indexOf
(
this
->
processes
,
p
,
Process_pidCompare
)
==
-
1
);
assert
(
Hashtable_get
(
this
->
processTable
,
pid
)
==
NULL
);
(
void
)
pid
;
assert
(
Hashtable_get
(
this
->
processTable
,
p
->
pid
)
==
NULL
);
}
}
Process
*
ProcessList_get
(
ProcessList
*
this
,
int
index
)
{
Process
*
ProcessList_get
(
ProcessList
*
this
,
int
index
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment