Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Systems744
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
SHREYANSH JAIN
Systems744
Commits
5edd01fa
Commit
5edd01fa
authored
Sep 05, 2019
by
SHREYANSH JAIN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor bug fix
parent
508bad1e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
assignment3/malloclab-handout/mm.c
assignment3/malloclab-handout/mm.c
+5
-1
No files found.
assignment3/malloclab-handout/mm.c
View file @
5edd01fa
...
...
@@ -135,6 +135,10 @@ void mm_free(void *ptr)
*/
void
*
mm_realloc
(
void
*
ptr
,
size_t
size
)
{
if
(
size
<=
0
){
mm_free
(
ptr
);
return
NULL
;
}
void
*
oldptr
=
ptr
;
struct
mm_block
*
blockPtr
=
(
struct
mm_block
*
)((
char
*
)
oldptr
-
SIZE_T_SIZE
);
void
*
newptr
;
...
...
@@ -150,8 +154,8 @@ void *mm_realloc(void *ptr, size_t size)
newptr
=
blockPtr
+
ALIGN
(
blockPtr
->
size
+
SIZE_T_SIZE
);
*
(
struct
mm_block
*
)
newptr
=
newBlock
;
freeList
[
freeListSize
++
]
=
(
struct
mm_block
*
)
newptr
;
return
oldptr
;
}
return
oldptr
;
}
newptr
=
mm_malloc
(
size
);
if
(
newptr
==
NULL
)
...
...
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