diff options
author | Damien George <damien.p.george@gmail.com> | 2014-08-29 21:07:54 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-08-29 21:07:54 +0100 |
commit | 17ae2395c24544a8263ecf1e88572a571325a1ec (patch) | |
tree | a78af85601754957b4d9f4d13970be756c619d4b /py/objlist.c | |
parent | 02d95d7ce9e12afa890b5ffb6a4d92fb593687ff (diff) | |
download | micropython-17ae2395c24544a8263ecf1e88572a571325a1ec.tar.gz micropython-17ae2395c24544a8263ecf1e88572a571325a1ec.zip |
py: Use memmove instead of memcpy when appropriate.
Found this bug by running unix/ tests with DEBUG=1 enabled when
compiling.
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objlist.c b/py/objlist.c index 578e39452a..e459f0deb1 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -274,7 +274,7 @@ STATIC mp_obj_t list_pop(uint n_args, const mp_obj_t *args) { uint index = mp_get_index(self->base.type, self->len, n_args == 1 ? MP_OBJ_NEW_SMALL_INT(-1) : args[1], false); mp_obj_t ret = self->items[index]; self->len -= 1; - memcpy(self->items + index, self->items + index + 1, (self->len - index) * sizeof(mp_obj_t)); + memmove(self->items + index, self->items + index + 1, (self->len - index) * sizeof(mp_obj_t)); // Clear stale pointer from slot which just got freed to prevent GC issues self->items[self->len] = MP_OBJ_NULL; if (self->alloc > LIST_MIN_ALLOC && self->alloc > 2 * self->len) { |