Skip to content

Commit

Permalink
[import] Don't leak returns of g_utf8_normalize.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Dec 17, 2022
1 parent 9a8142c commit 092d67e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gnucash/import-export/import-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,22 +862,25 @@ notes_append (Transaction* selected_match_trans, gchar* new_notes)
static char*
maybe_append_string (const char* match_string, const char* imp_string)
{
char *norm_match_string, *norm_imp_string;
char *norm_match_string, *norm_imp_string, *retval = NULL;

if (!(match_string && *match_string))
return g_strdup(imp_string);

if (!(imp_string && *imp_string))
return NULL;
return retval;

norm_match_string = g_utf8_normalize (match_string, -1, G_NORMALIZE_ALL);
norm_imp_string = g_utf8_normalize (imp_string, -1, G_NORMALIZE_ALL);

if (g_utf8_strlen (norm_imp_string, -1) > g_utf8_strlen (norm_match_string, -1) ||
!strstr (norm_match_string, norm_imp_string))
return g_strconcat(match_string, "|", imp_string, NULL);
retval = g_strconcat(match_string, "|", imp_string, NULL);

g_free (norm_match_string);
g_free (norm_imp_string);
return retval;

return NULL;
}

/* Append or replace transaction description and notes
Expand Down

0 comments on commit 092d67e

Please sign in to comment.