Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
410f3077
Commit
410f3077
authored
Apr 25, 2014
by
Damien George
Browse files
py, gc: Fix old gc_realloc for case when NULL is passed in as ptr.
parent
5be40afb
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/gc.c
View file @
410f3077
...
...
@@ -435,14 +435,17 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
if (n_bytes <= n_existing) {
return ptr;
} else {
// TODO false is incorrect! Should get value from current block!
void *ptr2 = gc_alloc(n_bytes,
bool has_finaliser;
if (ptr == NULL) {
has_finaliser = false;
} else {
#if MICROPY_ENABLE_FINALISER
FTB_GET(BLOCK_FROM_PTR((machine_uint_t)ptr))
has_finaliser =
FTB_GET(BLOCK_FROM_PTR((machine_uint_t)ptr))
;
#else
false
has_finaliser =
false
;
#endif
);
}
void
*
ptr2
=
gc_alloc
(
n_bytes
,
has_finaliser
);
if
(
ptr2
==
NULL
)
{
return
ptr2
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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