Fix memory leak in xaccTransGetReadOnly

In addition implement a cache for this value as suggested in the comments
as this function is called on every transaction commit.
This commit is contained in:
Geert Janssens
2018-09-09 22:49:52 +02:00
parent 3634e8f59d
commit d069b67d48
5 changed files with 48 additions and 16 deletions

View File

@@ -110,6 +110,15 @@ struct transaction_s
* any changes made if/when the edit is abandoned.
*/
Transaction *orig;
/* The readonly_reason is a string that indicates why a transaction
* is marked as read-only. If NULL, the transaction is read-write.
* This value is stored in kvp, but we cache a copy here for
* performance reasons. reason_cache_valid indicates whether the
* cached value is valid.
*/
char * readonly_reason;
gboolean reason_cache_valid;
};
struct _TransactionClass