diff options
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index ad669614bb..aad29462cc 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -1407,19 +1407,14 @@ FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Init(FPDF_BSTR* str) { FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str, FPDF_LPCSTR bstr, int length) { - if (!str) - return -1; - if (!bstr || !length) + if (!str || !bstr || !length) return -1; + if (length == -1) length = strlen(bstr); if (length == 0) { - if (str->str) { - FX_Free(str->str); - str->str = nullptr; - } - str->len = 0; + FPDF_BStr_Clear(str); return 0; } |