hw/ssi/pnv_spi: Fixes Coverity CID 1558831
authorChalapathi V <chalapathi.v@linux.ibm.com>
Wed, 7 Aug 2024 20:28:04 +0000 (22:28 +0200)
committerNicholas Piggin <npiggin@gmail.com>
Sun, 3 Nov 2024 23:09:15 +0000 (09:09 +1000)
In this commit the following coverity scan defect has been fixed
CID 1558831:  Resource leaks  (RESOURCE_LEAK)
  Variable "rsp_payload" going out of scope leaks the storage it
  points to.

Cc: qemu-stable@nongnu.org
Fixes: Coverity CID 1558831
Signed-off-by: Chalapathi V <chalapathi.v@linux.ibm.com>
Fixes: b4cb930e40 ("hw/ssi: Extend SPI model")
[PMD: Rebased on previous commit (returning earlier)]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
hw/ssi/pnv_spi.c

index 72bcc00de75591ca89a840ae47576124731dfc50..c21b2ebb3c2e67eac388cb8f2854fb9ddaaa65b3 100644 (file)
@@ -239,6 +239,7 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload)
         }
     }
     spi_response(s, s->N1_bits, rsp_payload);
+    pnv_spi_xfer_buffer_free(rsp_payload);
 }
 
 static inline uint8_t get_seq_index(PnvSpi *s)