summaryrefslogtreecommitdiff
path: root/libgphoto2/gphoto2-file.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2013-10-08 06:48:30 +0000
committerMarcus Meissner <marcus@jet.franken.de>2013-10-08 06:48:30 +0000
commit54a60266c5d492d3421c75509d9c3a18ea50c51c (patch)
tree9f4a2f0437eb227c6d524ca3481a3626497cbcd0 /libgphoto2/gphoto2-file.c
parent1a003f310b59785f2c03f500020302456762c0bc (diff)
downloadlibgphoto2-54a60266c5d492d3421c75509d9c3a18ea50c51c.tar.gz
added a missing fclose in an errorcase (Coverity)
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14561 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-file.c')
-rw-r--r--libgphoto2/gphoto2-file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgphoto2/gphoto2-file.c b/libgphoto2/gphoto2-file.c
index ee3507455..cb01a58fb 100644
--- a/libgphoto2/gphoto2-file.c
+++ b/libgphoto2/gphoto2-file.c
@@ -659,8 +659,10 @@ gp_file_open (CameraFile *file, const char *filename)
switch (file->accesstype) {
case GP_FILE_ACCESSTYPE_MEMORY:
file->data = malloc (sizeof(char)*(size + 1));
- if (!file->data)
+ if (!file->data) {
+ fclose (fp);
return (GP_ERROR_NO_MEMORY);
+ }
size_read = fread (file->data, (size_t)sizeof(char), (size_t)size, fp);
if (ferror(fp)) {
gp_file_clean (file);