diff options
author | Hubert Figuière <hub@figuiere.net> | 2014-01-27 22:41:41 -0500 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2014-01-27 22:41:41 -0500 |
commit | c8c9bda727bcad559c684b9b9759d867671e8db6 (patch) | |
tree | e7ebeca5626a04bd8f0074958e33920def9fd71c /XMPFiles | |
parent | f25392823b5571fee143f1343c5aead4c0950c9b (diff) |
Fix clang-analyzer errors.
Diffstat (limited to 'XMPFiles')
-rw-r--r-- | XMPFiles/source/FormatSupport/IPTC_Support.cpp | 2 | ||||
-rw-r--r-- | XMPFiles/source/FormatSupport/PSIR_FileWriter.cpp | 2 |
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. |