Merge lp:~charlesk/libindicate/lp-957970 into lp:libindicate/0.7

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 450
Merge reported by: Charles Kerr
Merged at revision: not available
Proposed branch: lp:~charlesk/libindicate/lp-957970
Merge into: lp:libindicate/0.7
Diff against target: 20 lines (+5/-2)
1 file modified
libindicate/indicator.c (+5/-2)
To merge this branch: bzr merge lp:~charlesk/libindicate/lp-957970
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+98060@code.launchpad.net

Description of the change

The list returned by g_hash_table_get_keys() needs to be freed with g_list_free().

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

This is fine. I think the reason for the +1 is that it gets built into a GStrv at the end and needs the final NULL.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicate/indicator.c'
2--- libindicate/indicator.c 2011-08-10 19:13:56 +0000
3+++ libindicate/indicator.c 2012-03-17 15:53:17 +0000
4@@ -599,12 +599,15 @@
5 IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
6
7 GList * keys = g_hash_table_get_keys(priv->properties);
8+ /* FIXME: what's the +1 for? */
9 GPtrArray * properties = g_ptr_array_sized_new(g_list_length(keys) + 1);
10
11- for (; keys != NULL; keys = keys->next) {
12- g_ptr_array_add(properties, g_strdup(keys->data));
13+ GList * l;
14+ for (l=keys; l!=NULL; l=l->next) {
15+ g_ptr_array_add(properties, g_strdup(l->data));
16 }
17
18+ g_list_free (keys);
19 return properties;
20 }
21

Subscribers

People subscribed via source and target branches