Malloc before memcpy in DCP parser

This commit is contained in:
Martijn Braam
2024-01-18 15:45:04 +01:00
parent 8925f732fb
commit 65f18b81d1

View File

@@ -1,6 +1,7 @@
#include "dcp.h" #include "dcp.h"
#include <libdng.h> #include <libdng.h>
#include <malloc.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -78,6 +79,7 @@ parse_calibration_file(const char *path)
memcpy(result.forward_matrix_1, temp.forward_matrix_1, 9 * sizeof(float)); memcpy(result.forward_matrix_1, temp.forward_matrix_1, 9 * sizeof(float));
memcpy(result.forward_matrix_2, temp.forward_matrix_2, 9 * sizeof(float)); memcpy(result.forward_matrix_2, temp.forward_matrix_2, 9 * sizeof(float));
result.tone_curve_length = temp.tone_curve_length; result.tone_curve_length = temp.tone_curve_length;
result.tone_curve = malloc(temp.tone_curve_length * sizeof(float));
memcpy(result.tone_curve, memcpy(result.tone_curve,
temp.tone_curve, temp.tone_curve,
temp.tone_curve_length * sizeof(float)); temp.tone_curve_length * sizeof(float));