From a95ff0596771f5e849366ba87985f91a3badd643 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Tue, 12 Dec 2006 11:33:03 +0000 Subject: [PATCH] Check for return value of regcomp() and return NULL on failure, as suggested by Jon Arney. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15208 57a11ea4-9604-0410-9ed3-97b8803252fd --- lib/libqof/qof/qofquerycore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libqof/qof/qofquerycore.c b/lib/libqof/qof/qofquerycore.c index bf29a01b23..374cd058ef 100644 --- a/lib/libqof/qof/qofquerycore.c +++ b/lib/libqof/qof/qofquerycore.c @@ -257,6 +257,7 @@ qof_query_string_predicate (QofQueryCompare how, gboolean is_regex) { query_string_t pdata; + int rc; g_return_val_if_fail (str, NULL); g_return_val_if_fail (*str != '\0', NULL); @@ -273,7 +274,12 @@ qof_query_string_predicate (QofQueryCompare how, if (options == QOF_STRING_MATCH_CASEINSENSITIVE) flags |= REG_ICASE; - regcomp(&pdata->compiled, str, flags); + rc = regcomp(&pdata->compiled, str, flags); + if (rc) { + g_free(pdata->matchstring); + g_free(pdata); + return NULL; + } pdata->is_regex = TRUE; }