diff --git a/libgphoto2/gphoto2-file.c b/libgphoto2/gphoto2-file.c index 04d4d5e3e..0820d64c5 100644 --- a/libgphoto2/gphoto2-file.c +++ b/libgphoto2/gphoto2-file.c @@ -715,7 +715,7 @@ gp_file_clean (CameraFile *file) switch (file->accesstype) { case GP_FILE_ACCESSTYPE_MEMORY: - free (file->data); + if (file->data) free (file->data); file->data = NULL; file->size = 0; break;