mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Clear redundant "description" when merging two cylinder types
dive.c: merge_cyclinder_type() can cause a small memory leak if two cylinder types are about to be merged, but the redundant one has a "description" string allocated. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
310b05ac84
commit
fd03fcd66d
1 changed files with 6 additions and 1 deletions
7
dive.c
7
dive.c
|
@ -815,8 +815,13 @@ static void merge_events(struct divecomputer *res, struct divecomputer *src1, st
|
|||
/* Pick whichever has any info (if either). Prefer 'a' */
|
||||
static void merge_cylinder_type(cylinder_type_t *res, cylinder_type_t *a, cylinder_type_t *b)
|
||||
{
|
||||
if (a->size.mliter)
|
||||
cylinder_type_t *clean = a;
|
||||
if (a->size.mliter) {
|
||||
clean = b;
|
||||
b = a;
|
||||
}
|
||||
if (clean->description)
|
||||
free((void *)clean->description);
|
||||
*res = *b;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue