Fix Svace issue : dereference memory 42/271642/1 accepted/tizen/unified/20220225.151859 submit/tizen/20220224.045724
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 24 Feb 2022 04:13:43 +0000 (13:13 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 24 Feb 2022 04:14:48 +0000 (13:14 +0900)
Change-Id: Ia8a584ac6755b8fa432e0563376f2c1511fdc3ac
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
src/libmtp.c

index b53877a..1b0d6a0 100755 (executable)
@@ -8858,6 +8858,9 @@ int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *device,
   // Go ahead and send the data
   propval.a.count = sampledata->size;
   propval.a.v = malloc(sizeof(PTPPropertyValue) * sampledata->size);
+  if (propval.a.v == NULL)
+      return -1;
+
   for (i = 0; i < sampledata->size; i++) {
     propval.a.v[i].u8 = sampledata->data[i];
   }