Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
d77159c5
Unverified
Commit
d77159c5
authored
Mar 31, 2022
by
Enkelmann
Committed by
GitHub
Mar 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent false double free warnings for parameter objects (#311)
parent
32aad93c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
12 deletions
+2
-12
mod.rs
..._checker_lib/src/analysis/pointer_inference/object/mod.rs
+2
-12
No files found.
src/cwe_checker_lib/src/analysis/pointer_inference/object/mod.rs
View file @
d77159c5
...
...
@@ -153,13 +153,8 @@ impl AbstractObject {
}
/// Mark the memory object as freed.
/// Returns an error if a possible double free is detected
/// or the memory object may not be a heap object.
/// Returns an error if a possible double free is detected.
pub
fn
mark_as_freed
(
&
mut
self
)
->
Result
<
(),
Error
>
{
if
self
.inner.type_
!=
Some
(
ObjectType
::
Heap
)
{
self
.set_state
(
ObjectState
::
Flagged
);
return
Err
(
anyhow!
(
"Free operation on possibly non-heap memory object"
));
}
let
inner
=
Arc
::
make_mut
(
&
mut
self
.inner
);
match
(
inner
.is_unique
,
inner
.state
)
{
(
true
,
ObjectState
::
Alive
)
|
(
true
,
ObjectState
::
Flagged
)
=>
{
...
...
@@ -182,13 +177,8 @@ impl AbstractObject {
}
/// Mark the memory object as possibly (but not definitely) freed.
/// Returns an error if the object was definitely freed before
/// or if the object may not be a heap object.
/// Returns an error if the object was definitely freed before.
pub
fn
mark_as_maybe_freed
(
&
mut
self
)
->
Result
<
(),
Error
>
{
if
self
.inner.type_
!=
Some
(
ObjectType
::
Heap
)
{
self
.set_state
(
ObjectState
::
Flagged
);
return
Err
(
anyhow!
(
"Free operation on possibly non-heap memory object"
));
}
let
inner
=
Arc
::
make_mut
(
&
mut
self
.inner
);
match
inner
.state
{
ObjectState
::
Dangling
=>
{
...
...
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