Skip to content

Commit

Permalink
Let Pointer deallocate error if it happens
Browse files Browse the repository at this point in the history
  • Loading branch information
attah committed Jul 4, 2024
1 parent bf636c7 commit 3e6f8d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pdf2printable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<GError> 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 + ")");
}

Expand Down

0 comments on commit 3e6f8d3

Please sign in to comment.