summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-11-25 14:37:12 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-11-25 14:37:12 +0000
commit7a13d4bcdb96ebc2ea84cc689937cf37d037362a (patch)
treeed81fadda4e95c08163896d13304f233fec33311 /plugins/AdvaImg
parent71e1d4ac0181c796b57ef4f6b13ad278a0a7ce58 (diff)
fix nullptr check
git-svn-id: http://svn.miranda-ng.org/main/trunk@11061 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg')
-rw-r--r--plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp b/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
index b3bc9f27f3..1e0237d115 100644
--- a/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
+++ b/plugins/AdvaImg/src/FreeImage/PluginJPEG.cpp
@@ -959,6 +959,9 @@ 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) {
@@ -966,23 +969,21 @@ jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) {
return FALSE;
}
- if(NULL != tag_value) {
- DWORD tag_length = FreeImage_GetTagLength(tag_exif);
+ DWORD tag_length = FreeImage_GetTagLength(tag_exif);
- BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE));
- if(profile == NULL) return FALSE;
+ BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE));
+ if(profile == NULL) return FALSE;
- 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);
- }
+ 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;