From 3e6f8d3ad6812114be187651e0e04a084591a755 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Thu, 4 Jul 2024 20:10:40 +0200 Subject: [PATCH] Let Pointer deallocate error if it happens --- lib/pdf2printable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pdf2printable.cpp b/lib/pdf2printable.cpp index fa61f86..1b804b8 100644 --- a/lib/pdf2printable.cpp +++ b/lib/pdf2printable.cpp @@ -87,10 +87,11 @@ Error pdf_to_printable(std::string inFile, WriteFun writeFun, const PrintParamet doc = poppler_document_new_from_file(url.c_str(), nullptr, &error); } + Pointer error_p(error, g_error_free); + if(doc == nullptr) { std::string errStr(error->message); - g_error_free(error); return Error("Failed to open PDF: " + errStr + " (" + inFile + ")"); }