From c5d4686660724b3cd0965a1753b44a7820c49def Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 27 May 2019 17:28:50 +0000 Subject: [PATCH] scst_lib: Add a scst_put_buf_full() call in scst_block_generic_dev_done() Avoid that Coverity complains (incorrectly) that there is a memory leak in an error path in scst_block_generic_dev_done(). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8368 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index b472bca5e..ed2a25e90 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -12487,8 +12487,10 @@ int scst_block_generic_dev_done(struct scst_cmd *cmd, buffer_size = scst_get_buf_full(cmd, &buffer); sect_sz_off = opcode == READ_CAPACITY ? 4 : 8; - if (buffer_size < sect_sz_off + 4) + if (buffer_size < sect_sz_off + 4) { + scst_put_buf_full(cmd, buffer); goto out; + } sector_size = get_unaligned_be32(&buffer[sect_sz_off]); scst_put_buf_full(cmd, buffer); if (sector_size != 0) {