summaryrefslogtreecommitdiff
path: root/fftools/cmdutils.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-03 14:34:47 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-05 13:27:38 +0100
commit2e7ef008e312bde7c151034628adc2da04313566 (patch)
tree501f672547c0a2d4f6b5e05e347b083db21cd958 /fftools/cmdutils.c
parent9d73967b40231b27504cb86ea177887be03bb328 (diff)
downloadffmpeg-2e7ef008e312bde7c151034628adc2da04313566.tar.gz
fftools/cmdutils: Make allocate_array_elem() return ptr to new element
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools/cmdutils.c')
-rw-r--r--fftools/cmdutils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 1464b122df..0b57552e5c 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -2216,8 +2216,9 @@ void *grow_array(void *array, int elem_size, int *size, int new_size)
void *allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
{
- void *new_elem, **array = (void**)ptr;
+ void *new_elem, **array;
+ memcpy(&array, ptr, sizeof(array));
if (*nb_elems == INT_MAX) {
av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
exit_program(1);
@@ -2226,8 +2227,9 @@ void *allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
if (!new_elem)
exit_program(1);
GROW_ARRAY(array, *nb_elems);
+ memcpy(ptr, &array, sizeof(array));
array[*nb_elems - 1] = new_elem;
- return array;
+ return new_elem;
}
double get_rotation(int32_t *displaymatrix)