mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
Use copy_string() to avoid potential crash
If the trip has no location or notes calling strdup on NULL is just a bad idea. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c30dfba433
commit
f8e9c975b7
1 changed files with 2 additions and 2 deletions
|
@ -47,8 +47,8 @@ void UndoDeleteDive::redo()
|
|||
if (d->divetrip && d->divetrip->nrdives == 1) {
|
||||
struct dive_trip *undo_trip = (struct dive_trip *)calloc(1, sizeof(struct dive_trip));
|
||||
*undo_trip = *d->divetrip;
|
||||
undo_trip->location = strdup(d->divetrip->location);
|
||||
undo_trip->notes = strdup(d->divetrip->notes);
|
||||
undo_trip->location = copy_string(d->divetrip->location);
|
||||
undo_trip->notes = copy_string(d->divetrip->notes);
|
||||
undo_trip->nrdives = 0;
|
||||
undo_trip->next = NULL;
|
||||
undo_trip->dives = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue