From: robertlipe Date: Sun, 24 Mar 2013 05:10:32 +0000 (+0000) Subject: Fix reference counting issues in gdb.cc and waypt.cc exposed by valgrind.Z X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~143^2^2~598 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2aa2f0b0b9fa5f7924ee30dcaaa0a646540ba1b4;p=gpsbabel.git Fix reference counting issues in gdb.cc and waypt.cc exposed by valgrind.Z --- diff --git a/gpsbabel/gdb.cc b/gpsbabel/gdb.cc index 09038461d..5efde6f96 100644 --- a/gpsbabel/gdb.cc +++ b/gpsbabel/gdb.cc @@ -1337,15 +1337,15 @@ write_waypoint( /* VERSION DEPENDENT CODE */ if (gdb_ver <= GDB_VER_2) { - char* descr; + QString descr; FWRITE(zbuf, 3); FWRITE(zbuf, 4); descr = (wpt_class < gt_waypt_class_map_point) ? - wpt->url.toUtf8().data() : wpt->description; + wpt->url : wpt->description; if ((descr != NULL) && (wpt_class >= gt_waypt_class_map_point) && \ - (strcmp(descr, wpt->shortname) == 0)) { - descr = NULL; + descr.compare(wpt->shortname) == 0) { + descr.clear(); } FWRITE_CSTR(descr); } else { /* if (gdb_ver > GDB_VER_3) */ diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index 2f5b89dc5..3cf5661c6 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -394,6 +394,9 @@ waypt_free(waypoint *wpt) if (wpt->notes) { xfree(wpt->notes); } + +#if 0 + // these are now ref counted... if (wpt->url_next) { url_link *url_next; @@ -404,6 +407,7 @@ waypt_free(waypoint *wpt) xfree(tonuke); } } +#endif if (wpt->gc_data != &empty_gc_data) { geocache_data *gc_data = (geocache_data *)wpt->gc_data;