summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp')
-rw-r--r--plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp b/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
index c1b45e6347..573989c5df 100644
--- a/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
+++ b/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
@@ -919,9 +919,6 @@ jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) {
if(tag_exif) {
const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_exif);
-
- if (NULL == tag_value)
- return FALSE;
// verify the identifying string
if(memcmp(exif_signature, tag_value, sizeof(exif_signature)) != 0) {
@@ -929,21 +926,23 @@ jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) {
return FALSE;
}
- DWORD tag_length = FreeImage_GetTagLength(tag_exif);
-
- BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE));
- if(profile == NULL) return FALSE;
+ if(NULL != tag_value) {
+ DWORD tag_length = FreeImage_GetTagLength(tag_exif);
- for(DWORD i = 0; i < tag_length; i += 65504L) {
- unsigned length = MIN((long)(tag_length - i), 65504L);
+ BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE));
+ if(profile == NULL) return FALSE;
- memcpy(profile, tag_value + i, length);
- jpeg_write_marker(cinfo, EXIF_MARKER, profile, length);
- }
+ for(DWORD i = 0; i < tag_length; i += 65504L) {
+ unsigned length = MIN((long)(tag_length - i), 65504L);
+
+ memcpy(profile, tag_value + i, length);
+ jpeg_write_marker(cinfo, EXIF_MARKER, profile, length);
+ }
- free(profile);
+ free(profile);
- return TRUE;
+ return TRUE;
+ }
}
return FALSE;