From a424bc8c4fdd4e05f0e7d9bfd9ecb7916d086508 Mon Sep 17 00:00:00 2001 From: Randy Bates Date: Fri, 22 May 2020 13:21:53 -0500 Subject: [PATCH] Fix segmentation if invalid customer id Attempting to free unallocated memory --- plugins/wdc/wdc-nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index c28f616..740b6be 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -3574,6 +3574,7 @@ static int wdc_get_ca_log_page(int fd, char *format) } else { fprintf(stderr, "ERROR : WDC : Unsupported Customer id, id = %d\n", *cust_id); + return -1; } break; @@ -3630,12 +3631,14 @@ static int wdc_get_ca_log_page(int fd, char *format) } else { fprintf(stderr, "ERROR : WDC : Unsupported Customer id, id = %d\n", *cust_id); + return -1; } break; default: fprintf(stderr, "ERROR : WDC : Log page 0xCA not supported for this device\n"); + return -1; break; } -- 2.49.0