From 03092d1a72a9651711e22c58dca6d6aba5705c5e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 14 Nov 2009 16:35:12 -0800 Subject: [PATCH] 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 --- ao-tools/lib/cc-logfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.30.2