summaryrefslogtreecommitdiff
path: root/XMPFiles
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2014-01-27 22:41:41 -0500
committerHubert Figuière <hub@figuiere.net>2014-01-27 22:41:41 -0500
commitc8c9bda727bcad559c684b9b9759d867671e8db6 (patch)
treee7ebeca5626a04bd8f0074958e33920def9fd71c /XMPFiles
parentf25392823b5571fee143f1343c5aead4c0950c9b (diff)
Fix clang-analyzer errors.
Diffstat (limited to 'XMPFiles')
-rw-r--r--XMPFiles/source/FormatSupport/IPTC_Support.cpp2
-rw-r--r--XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/XMPFiles/source/FormatSupport/IPTC_Support.cpp b/XMPFiles/source/FormatSupport/IPTC_Support.cpp
index e8fda45..edc9266 100644
--- a/XMPFiles/source/FormatSupport/IPTC_Support.cpp
+++ b/XMPFiles/source/FormatSupport/IPTC_Support.cpp
@@ -513,7 +513,7 @@ void IPTC_Writer::SetDataSet_UTF8 ( XMP_Uns8 dsNum, const void* utf8Ptr, XMP_Uns
}
}
- XMP_Uns8 * dataPtr = (XMP_Uns8*) malloc ( dataLen );
+ XMP_Uns8 * dataPtr = dataLen ? (XMP_Uns8*) malloc ( dataLen ) : NULL;
if ( dataPtr == 0 ) XMP_Throw ( "Out of memory", kXMPErr_NoMemory );
memcpy ( dataPtr, tempPtr, dataLen ); // AUDIT: Safe, malloc'ed dataLen bytes above.
diff --git a/XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp b/XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp
index 5d06220..12adc58 100644
--- a/XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp
+++ b/XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp
@@ -409,7 +409,7 @@ XMP_Uns32 PSIR_FileWriter::UpdateMemoryResources ( void** dataPtr )
newLength += this->otherRsrcs[i].rsrcLength;
}
- XMP_Uns8* newContent = (XMP_Uns8*) malloc ( newLength );
+ XMP_Uns8* newContent = newLength ? (XMP_Uns8*) malloc ( newLength ) : NULL;
if ( newContent == 0 ) XMP_Throw ( "Out of memory", kXMPErr_NoMemory );
// Fill in the new image resource block.