mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
Don't re-use the dive computer model string for all downloaded dives
When we download dives with libdivecomputer, we create this strdup'ed name of the model information, but we then re-use that (single) strdup allocation for every dive we download. This works fine *until* you start freeing those dives (possibly directly after the download because they are redundant), at which point things go to hell in a handbasket, since there is just the one allocation for all the different dives. Fix by just doing another strdup() at the point where we assign the model information to the dive computer. Reported-by: Marc Merlin <marc@merlins.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a1ef8e5502
commit
50170e0cf3
1 changed files with 1 additions and 1 deletions
|
@ -420,7 +420,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
dive->dc.model = devdata->model;
|
||||
dive->dc.model = strdup(devdata->model);
|
||||
dive->dc.deviceid = devdata->deviceid;
|
||||
dive->dc.diveid = calculate_diveid(fingerprint, fsize);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue