From dc6373488ff34cb16bb058c5ef50f279c435f76e Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 22 Jun 2008 20:18:11 +0200 Subject: [PATCH] wipe elements overwritten by a splice Signed-off-by: Pierre Habouzit --- common/array.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/array.h b/common/array.h index 57d24388d..54873174a 100644 --- a/common/array.h +++ b/common/array.h @@ -61,6 +61,9 @@ assert (pos <= arr->len && pos + len < arr->len); \ if (len != count) { \ pfx##_array_grow(arr, arr->len + count - len); \ + for (int i = pos; i < pos + len; i++) { \ + dtor(&arr->tab[i]); \ + } \ memmove(arr->tab + pos + count, arr->tab + pos + len, \ arr->len - pos - len); \ arr->len += count - len; \