diff --git a/src/basicio.cpp b/src/basicio.cpp index d5e0f836..8837f0bb 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -889,7 +889,7 @@ void XPathIo::ReadDataUri(const std::string& path) { throw Error(ErrorCode::kerErrorMessage, "No base64 data"); std::string data = path.substr(base64Pos + 7); - char* decodeData = new char[data.length()]; + auto decodeData = new char[data.length()]; auto size = base64decode(data.c_str(), decodeData, data.length()); if (size > 0) write((byte*)decodeData, size); diff --git a/src/properties.cpp b/src/properties.cpp index 6cbc73be..2462c827 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -4899,10 +4899,10 @@ void XmpProperties::registerNs(const std::string& ns, const std::string& prefix) // Using malloc/free for better system compatibility in case // users don't unregister their namespaces explicitly. XmpNsInfo xn; - auto c = static_cast(std::malloc(ns2.size() + 1)); + auto c = new char[ns2.size() + 1]; std::strcpy(c, ns2.c_str()); xn.ns_ = c; - c = static_cast(std::malloc(prefix.size() + 1)); + c = new char[prefix.size() + 1]; std::strcpy(c, prefix.c_str()); xn.prefix_ = c; xn.xmpPropertyInfo_ = nullptr; @@ -4918,8 +4918,8 @@ void XmpProperties::unregisterNs(const std::string& ns) { void XmpProperties::unregisterNsUnsafe(const std::string& ns) { auto i = nsRegistry_.find(ns); if (i != nsRegistry_.end()) { - std::free(const_cast(i->second.prefix_)); - std::free(const_cast(i->second.ns_)); + delete[] i->second.prefix_; + delete[] i->second.ns_; nsRegistry_.erase(i); } }