Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Bastien Legoy
ensimag-malloc
Commits
ce3e94f3
Commit
ce3e94f3
authored
Jan 19, 2022
by
legoyb
Browse files
Buddy has gone too far (2)
parent
be387750
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/mem_medium.c
src/mem_medium.c
+6
-2
No files found.
src/mem_medium.c
View file @
ce3e94f3
...
...
@@ -108,7 +108,11 @@ void efree_medium(Alloc a) {
if
(
head
==
buddy
)
{
// Remove from List
*
(
void
**
)
previous_head
=
*
(
void
**
)
head
;
printf
(
"Previous: %p
\n
"
,
previous_head
);
//DEBUG
if
(
previous_head
!=
NULL
)
*
(
void
**
)
previous_head
=
*
(
void
**
)
head
;
else
arena
.
TZL
[
index
]
=
*
(
void
**
)
head
;
printf
(
"Head: %p
\n
"
,
head
);
//DEBUG
// Add new Block
void
*
target_head
=
((
unsigned
long
)
ptr
<
(
unsigned
long
)
buddy
)
?
ptr
:
buddy
;
*
(
void
**
)
target_head
=
arena
.
TZL
[
index
+
1
];
...
...
@@ -116,7 +120,7 @@ void efree_medium(Alloc a) {
// Recursive Call
Alloc
next
=
a
;
next
.
size
<<=
1
;
next
.
ptr
=
target_head
;
next
.
ptr
=
(
target_head
+
16
)
;
efree_medium
(
next
);
return
;
...
...
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