[recipes] Fix a length mismatch in shopping list saving
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Fix a length mismatch in shopping list saving
- Date: Fri, 3 Mar 2017 23:13:23 +0000 (UTC)
commit 4a83b7eaa18c0422ff00e4b68250fee8d1089ca8
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 3 18:11:39 2017 -0500
Fix a length mismatch in shopping list saving
I haven't been able to reproduce the crash in
https://bugzilla.gnome.org/show_bug.cgi?id=779539
but this change might fix it.
src/gr-recipe-store.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index ba6b65e..26197a9 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -1509,13 +1509,14 @@ gr_recipe_store_add_to_shopping (GrRecipeStore *self,
length = g_strv_length (self->shopping);
strv = g_new (char *, length + 2);
strv[0] = g_strdup (id);
- intv = g_new (int, length + 1);
+ intv = g_new (int, length + 2);
intv[0] = serves;
for (i = 0; i < length; i++) {
strv[i + 1] = self->shopping[i];
intv[i + 1] = self->shopping_serves[i];
}
strv[length + 1] = NULL;
+ intv[length + 1] = 0;
g_free (self->shopping);
g_free (self->shopping_serves);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]