From 39938a86fe17cc0100808b7e7a63b04ddc19d105 Mon Sep 17 00:00:00 2001 From: Gyorgy Sarvari Date: Tue, 17 Dec 2024 08:01:17 +0100 Subject: [PATCH] Fix incorrectly sized malloc 0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch is meta-oe is changing a dynamiic memory allocation to a malloc one, however without specifying the size of the type, allocating an incorrect amount. This makes applications crash when using this function with "munmap_chunk(): invalid pointer " error. This patch adds the correct size for the allocation. Upstream-Status: Inappropriate --- src/ipa/rpi/controller/rpi/alsc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp index a7d42614..8ab0c7d5 100644 --- a/src/ipa/rpi/controller/rpi/alsc.cpp +++ b/src/ipa/rpi/controller/rpi/alsc.cpp @@ -496,8 +496,8 @@ void resampleCalTable(const Array2D &calTableIn, * Precalculate and cache the x sampling locations and phases to save * recomputing them on every row. */ - int *xLo = (int*)malloc(X), *xHi = (int*)malloc(X); - double *xf = (double*)malloc(X); + int *xLo = (int*)malloc(X * sizeof(int)), *xHi = (int*)malloc(X * sizeof(int)); + double *xf = (double*)malloc(X * sizeof(double)); double scaleX = cameraMode.sensorWidth / (cameraMode.width * cameraMode.scaleX); double xOff = cameraMode.cropX / (double)cameraMode.sensorWidth; -- 2.47.1