Browse Source

Malloc before memcpy in DCP parser

Martijn Braam 1 year ago
parent
commit
65f18b81d1
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/dcp.c

+ 2 - 0
src/dcp.c

@@ -1,6 +1,7 @@
 #include "dcp.h"
 
 #include <libdng.h>
+#include <malloc.h>
 #include <stdbool.h>
 #include <stdio.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_2, temp.forward_matrix_2, 9 * sizeof(float));
         result.tone_curve_length = temp.tone_curve_length;
+        result.tone_curve = malloc(temp.tone_curve_length * sizeof(float));
         memcpy(result.tone_curve,
                temp.tone_curve,
                temp.tone_curve_length * sizeof(float));