mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
core/csv-import: don't do pointer math after realloc
try_to_xslt_open_csv() re-allocates the memory passed in (not really great as far as design goes, maybe something that should be reimplemented). Doing pointer arithmatic with the returned base pointer results in garbage, unless one gets super lucky and the realloc manages to not move the memory. It's a wonder this ever worked. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
846e1ba53e
commit
c90352008b
1 changed files with 2 additions and 1 deletions
|
@ -245,6 +245,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str
|
|||
return -1;
|
||||
}
|
||||
mem_csv.size = ptr - (char*)mem_csv.buffer;
|
||||
end_ptr += ptr - (char *)mem_csv.buffer;
|
||||
|
||||
iter = parse_dan_new_line(ptr + 1, NL);
|
||||
if (iter && strncmp(iter, "ZDT", 3) == 0) {
|
||||
|
@ -268,7 +269,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str
|
|||
return -1;
|
||||
|
||||
ret |= parse_xml_buffer(filename, mem_csv.buffer, mem_csv.size, table, trips, sites, devices, filter_presets, params);
|
||||
end_ptr += ptr - (char *)mem_csv.buffer;
|
||||
|
||||
free(mem_csv.buffer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue