[gcompris] gletters, fix a crash case in a free
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] gletters, fix a crash case in a free
- Date: Mon, 11 Apr 2016 18:48:28 +0000 (UTC)
commit 5946490d435b0ba22cfebe5c3beba867f30d8756
Author: Hans de Goede <j w r degoede gmail com>
Date: Mon Apr 11 20:43:37 2016 +0200
gletters, fix a crash case in a free
src/gletters-activity/gletters.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/gletters-activity/gletters.c b/src/gletters-activity/gletters.c
index aca5af5..eba3eb0 100644
--- a/src/gletters-activity/gletters.c
+++ b/src/gletters-activity/gletters.c
@@ -323,19 +323,22 @@ set_level (guint level)
*/
static int is_letter_equal(gchar *letter1, gchar *letter2)
{
- int success=FALSE;
+ int success;
+
if (uppercase_only)
{
- gchar *old = letter1;
- letter1 = g_utf8_strup(old, -1);
- g_free(old);
- success = strcmp(letter2,g_utf8_strdown(letter1,-1))==0;
- success = success || strcmp(letter2,g_utf8_strup(letter1,-1))==0;
+ letter1 = g_utf8_strup(letter1, -1);
+ letter2 = g_utf8_strup(letter2, -1);
}
- else
+
+ success = strcmp(letter2,letter1)==0;
+
+ if (uppercase_only)
{
- success = strcmp(letter2,letter1)==0;
+ g_free(letter1);
+ g_free(letter2);
}
+
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]