Hi,
I have found an error in the SDK handling rewrite of JPEG APP13 photoshop blocks. The error happens when an existing resource block changes data, and rsrcName is kept.
suggested sollution in source/XMPFiles/FormatSupport/PSIR_Support.hpp
in the class PSIR_FileWriter - struct InternalRsrcInfo:
@@ -246,7 +246,17 @@ public:
struct InternalRsrcInfo {
public:
+#define HT_CHANGED 1
+#ifdef HT_CHANGED
+ bool changed; // Meaning dataPtr has changed. rsrcName is never changed
+ // see e.g. SetImgRsrc (when changed content of data - else part),
+ // where dataPtr is freed and and new
+ // block is allocated. rsrcName is not realloc'ed - will
+ // then fail with free error in FreeName below with free
+ // "pointer being freed was not allocated"
+#else
bool changed;
+#endif
bool fileBased;
XMP_Uns16 id;
XMP_Uns32 dataLen;
@@ -261,7 +271,11 @@ public:
}
inline void FreeName() {
+#ifdef HT_CHANGED
+ if ( this->fileBased ) {
+#else
if ( this->fileBased || this->changed ) {
+#endif
if ( this->rsrcName != 0 ) { free ( this->rsrcName ); this->rsrcName = 0; }
}
}
fileBased is false.
This resolves my problem. Please consider including this in future release.
Comments / questions are welcome.
/Henrik
North America
Europe, Middle East and Africa
Asia Pacific