diff options
author | Keith Packard <keithp@keithp.com> | 2009-11-14 16:35:12 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-11-14 16:35:12 -0800 |
commit | 03092d1a72a9651711e22c58dca6d6aba5705c5e (patch) | |
tree | 541beabd46094c6d33416b8729ee490f969d2154 /ao-tools/lib | |
parent | adf656192441eb7f44792955c86e469145477e29 (diff) |
ao-postflight: fix sloppy gps sat data realloc code (was crashing).
Realloc'ing the wrong data, and failing to set the realloc'ed size was
causing ao-postflight to crash while reading long logs.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib')
-rw-r--r-- | ao-tools/lib/cc-logfile.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ao-tools/lib/cc-logfile.c b/ao-tools/lib/cc-logfile.c index 2136eec4..3d346bcc 100644 --- a/ao-tools/lib/cc-logfile.c +++ b/ao-tools/lib/cc-logfile.c @@ -101,11 +101,12 @@ gpssat_add(struct cc_gpsdata *data, struct cc_gpssat *sat) if (data->sizesats == 0) newsats = malloc((newsizesats = 256) * sizeof (struct cc_gpssats)); else - newsats = realloc (data->data, (newsizesats = data->sizesats * 2) + newsats = realloc (data->sats, (newsizesats = data->sizesats * 2) * sizeof (struct cc_gpssats)); if (!newsats) return 0; data->sats = newsats; + data->sizesats = newsizesats; } i = data->numsats++; data->sats[i].nsat = 0; |