[PATCH 4/5] When a dive computer is deleted also clear its model

Lubomir I. Ivanov neolit123 at gmail.com
Sun Dec 23 17:53:27 PST 2012


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

dive.c:
A dive computer may have its model allocated in memory.
Let's clear that as well when calling free_dc().

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 dive.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dive.c b/dive.c
index b5fb138..8d1c716 100644
--- a/dive.c
+++ b/dive.c
@@ -1251,6 +1251,8 @@ static void free_events(struct event *ev)
 static void free_dc(struct divecomputer *dc)
 {
 	free(dc->sample);
+	if (dc->model)
+		free((void *)dc->model);
 	free_events(dc->events);
 	free(dc);
 }
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list