From 67e8e46cfdcbaf8d45825c8050d50cca62ec9d85 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 6 Feb 2016 17:11:23 +0100 Subject: free buf0 and buf1 on error exit (Coverity) --- camlibs/st2205/st2205.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/camlibs/st2205/st2205.c b/camlibs/st2205/st2205.c index db224ab1a..1ce5ffba4 100644 --- a/camlibs/st2205/st2205.c +++ b/camlibs/st2205/st2205.c @@ -217,15 +217,21 @@ st2205_detect_mem_size(Camera *camera) } ret = st2205_read_block(camera, 0, buf0); - if (ret) + if (ret) { + st2205_free_page_aligned(buf0, ST2205_BLOCK_SIZE); + st2205_free_page_aligned(buf1, ST2205_BLOCK_SIZE); return ret; + } for (i = 0; i < 3; i++) { ret = st2205_read_block(camera, (524288 / ST2205_BLOCK_SIZE) << i, buf1); - if (ret) + if (ret) { + st2205_free_page_aligned(buf0, ST2205_BLOCK_SIZE); + st2205_free_page_aligned(buf1, ST2205_BLOCK_SIZE); return ret; + } if (memcmp(buf0, buf1, ST2205_BLOCK_SIZE) == 0) break; } -- cgit v1.2.1