Remove CPDF_StreamAcc::m_pSrcData.
It just ends up being a nullptr, so it is not useful.
Change-Id: I52fcbb261c4bb0bc024e1856da95028431d577c1
Reviewed-on: https://pdfium-review.googlesource.com/42591
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 78bcb57..4614dae 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -14,7 +14,6 @@
CPDF_StreamAcc::~CPDF_StreamAcc() {
if (m_bNewBuf)
FX_Free(m_pData);
- FX_Free(m_pSrcData);
}
void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
@@ -42,12 +41,12 @@
if (m_pStream->IsMemoryBased()) {
pSrcData = m_pStream->GetInMemoryRawData();
} else {
- pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
- if (!m_pStream->ReadRawData(0, pSrcData, dwSrcSize)) {
- FX_Free(pSrcData);
- pSrcData = m_pSrcData = nullptr;
+ std::unique_ptr<uint8_t, FxFreeDeleter> pTempSrcData(
+ FX_Alloc(uint8_t, dwSrcSize));
+ if (!m_pStream->ReadRawData(0, pTempSrcData.get(), dwSrcSize))
return;
- }
+
+ pSrcData = pTempSrcData.release();
}
if (bProcessRawData) {
m_pData = pSrcData;
@@ -60,7 +59,6 @@
}
if (pSrcData != m_pStream->GetInMemoryRawData() && pSrcData != m_pData)
FX_Free(pSrcData);
- m_pSrcData = nullptr;
m_bNewBuf = m_pData != m_pStream->GetInMemoryRawData();
}
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index ddbdc6a..6ecfece 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -53,7 +53,6 @@
ByteString m_ImageDecoder;
UnownedPtr<const CPDF_Dictionary> m_pImageParam;
UnownedPtr<const CPDF_Stream> const m_pStream;
- uint8_t* m_pSrcData = nullptr;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_