Free strduped prefs before exit

This plugs a leak detected by valgrind.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-12-18 08:47:42 +01:00 committed by Dirk Hohndel
parent be1b79081d
commit da154222cc
3 changed files with 19 additions and 0 deletions

View file

@ -68,5 +68,6 @@ int main(int argc, char **argv)
exit_ui();
parse_xml_exit();
subsurface_console_exit();
free_prefs();
return 0;
}

View file

@ -219,3 +219,20 @@ void setup_system_prefs(void)
default_prefs.units = IMPERIAL_units;
}
/*
* Free strduped prefs before exit.
*
* These are not real leaks but they plug the holes found by eg.
* valgrind so you can find the real leaks.
*/
void free_prefs(void)
{
free((void*)prefs.default_filename);
free((void*)prefs.default_cylinder);
free((void*)prefs.divelist_font);
free(prefs.proxy_host);
free(prefs.proxy_user);
free(prefs.proxy_pass);
free(prefs.userid);
}

View file

@ -15,6 +15,7 @@ extern bool imported;
void setup_system_prefs(void);
void parse_argument(const char *arg);
void free_prefs(void);
#ifdef __cplusplus
}