[PATCH] lib: fwts_pipeio: fix regression from memory leak fix

Deb McLemore debmc at linux.vnet.ibm.com
Mon Apr 9 21:22:03 UTC 2018


Commit c4435dca34093fa25cfcd6d9debd668de1cfcfba regressed cases
where bytes read is zero which results in out_size of zero but
there will not be memory allocated and the condition is valid
for the caller.

Signed-off-by: Deb McLemore <debmc at linux.vnet.ibm.com>
---
 src/lib/src/fwts_pipeio.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
index 60030de..3b3cfaf 100644
--- a/src/lib/src/fwts_pipeio.c
+++ b/src/lib/src/fwts_pipeio.c
@@ -219,11 +219,9 @@ int fwts_pipe_readwrite(
 
 	}
 
-	if (out_size) {
-		*out_len = out_size;
-		*out_buf = ptr;
-		return 0;
-	}
+	*out_len = out_size;
+	*out_buf = ptr;
+	return 0;
 fail:
 	free(ptr);
 	*out_len = 0;
-- 
2.7.4




More information about the fwts-devel mailing list