Merge lp:~mterry/geonames/double-free into lp:geonames

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 21
Merged at revision: 21
Proposed branch: lp:~mterry/geonames/double-free
Merge into: lp:geonames
Diff against target: 12 lines (+1/-1)
1 file modified
src/geonames.c (+1/-1)
To merge this branch: bzr merge lp:~mterry/geonames/double-free
Reviewer Review Type Date Requested Status
Michał Sawicz (community) Approve
Geonames developers Pending
Review via email: mp+287359@code.launchpad.net

Commit message

Fix double-free when querying.

Description of the change

Fix double-free when querying.

To post a comment you must log in.
Revision history for this message
Allison Karlitskaya (desrt) wrote :

Since we're no longer discarding const, you can also drop the cast.

Looks good, otherwise. Surprised this never caused a problem before.

lp:~mterry/geonames/double-free updated
21. By Michael Terry

drop cast

Revision history for this message
Michael Terry (mterry) wrote :

Good point, fixed!

I am also surprised this didn't come up before. Even for me, it only introduced oddities in results, not a crash.

Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/geonames.c'
2--- src/geonames.c 2015-10-07 07:44:59 +0000
3+++ src/geonames.c 2016-03-01 20:04:04 +0000
4@@ -94,7 +94,7 @@
5 ensure_geonames_data ();
6
7 task = g_task_new (NULL, cancellable, callback, user_data);
8- g_task_set_task_data (task, (gpointer) query, g_free);
9+ g_task_set_task_data (task, g_strdup (query), g_free);
10
11 g_task_run_in_thread (task, task_func);
12 }

Subscribers

People subscribed via source and target branches