From: tsteven4 Date: Sat, 3 Aug 2013 00:18:37 +0000 (+0000) Subject: fix segmentation fault if tpo reads multiple input files. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~458 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9ef606d89b4be319420b13a7640cae6d188eb55c;p=gpsbabel.git fix segmentation fault if tpo reads multiple input files. --- diff --git a/gpsbabel/tpo.cc b/gpsbabel/tpo.cc index 02b19279a..1e5990826 100644 --- a/gpsbabel/tpo.cc +++ b/gpsbabel/tpo.cc @@ -808,7 +808,7 @@ void tpo_process_tracks(void) // For version 3.x files. // waypoint** tpo_wp_index; -unsigned int tpo_index_ptr = 0; +unsigned int tpo_index_ptr; @@ -837,6 +837,7 @@ void tpo_process_waypoints(void) // Fetch storage for the waypoint index (needed later for // routes) tpo_wp_index = (waypoint**) xmalloc(sizeof(waypoint*) * waypoint_count); + tpo_index_ptr = 0; if (waypoint_count == 0) { return; @@ -1411,6 +1412,8 @@ static void tpo_rd_init(const char* fname) { + tpo_index_ptr = 0; + tpo_file_in = gbfopen_le(fname, "rb", MYNAME); tpo_check_version_string();