summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2016-02-06 17:11:23 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-02-06 17:11:23 +0100
commit67e8e46cfdcbaf8d45825c8050d50cca62ec9d85 (patch)
tree7f9a4ec2ffcb4a6a40d82f88e09ffc900856dd0e
parent0d33b68e336e953c1702daecef25176715b0a38e (diff)
downloadlibgphoto2-67e8e46cfdcbaf8d45825c8050d50cca62ec9d85.tar.gz
free buf0 and buf1 on error exit (Coverity)
-rw-r--r--camlibs/st2205/st2205.c10
1 files 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;
}