Bug 798545 - Crash when updating document link on vendor bill

There were two issues here, the first one was that the copied doclink
was pointing to the original doclink which lead to a double-free. The
second is the setting of the doclink on the copied invoice needs to be
done with gncInvoiceSetDocLink otherwise on closure the doclink value
will disappear.
This commit is contained in:
Robert Fewell 2022-11-24 11:16:01 +00:00
parent 80f1101447
commit 59d95a4ce6

View File

@ -379,7 +379,10 @@ GncInvoice *gncInvoiceCopy (const GncInvoice *from)
// Oops. Do not forget to copy the pointer to the correct currency here.
invoice->currency = from->currency;
invoice->doclink = from->doclink;
if (from->doclink == is_unset)
invoice->doclink = (char*)is_unset;
else
gncInvoiceSetDocLink (invoice, from->doclink);
// Copy all invoice->entries
for (node = from->entries; node; node = node->next)