From b45a8bfbb454160e8e4a2f4925a0c1ad27ef92c2 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Mon, 27 Jul 2009 19:35:09 +0000 Subject: Work on allocating and freeing memory associated with user's data for the daemon. --- ChangeLog | 7 +++++++ src/dmon.c | 7 +++++-- src/utils.c | 30 ++++++++++++++++++------------ src/utils.h | 3 ++- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7eb2e2c..4d60b63 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-07-27 Frederic Culot + + * src/utils.c (free_user_data): new function + + * src/dmon.c: work on allocating and freeing memory associated + with user data + 2009-07-26 Frederic Culot * src/args.c (parse_args): check for file presence added (thanks diff --git a/src/dmon.c b/src/dmon.c index 8a2f66a..772b92f 100644 --- a/src/dmon.c +++ b/src/dmon.c @@ -1,4 +1,4 @@ -/* $calcurse: dmon.c,v 1.5 2009/07/26 21:03:21 culot Exp $ */ +/* $calcurse: dmon.c,v 1.6 2009/07/27 19:35:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -67,7 +67,8 @@ static void dmon_sigs_hdlr (int sig) { - notify_free_app (); + free_user_data (); + DMON_LOG (_("terminated at %s with signal %d\n"), nowstr (), sig); if (unlink (path_dpid) != 0) @@ -164,6 +165,8 @@ dmon_start (int parent_exit_status) custom_load_conf (&conf, 0); io_check_file (path_apts, (int *)0); + apoint_llist_init (); + recur_apoint_llist_init (); io_load_app (); for (;;) diff --git a/src/utils.c b/src/utils.c index b4e7a93..37eab66 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $calcurse: utils.c,v 1.80 2009/07/26 20:26:16 culot Exp $ */ +/* $calcurse: utils.c,v 1.81 2009/07/27 19:35:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -80,17 +80,7 @@ exit_calcurse (int status) calendar_stop_date_thread (); io_stop_psave_thread (); - day_free_list (); - event_llist_free (); - event_free_bkp (ERASE_FORCE); - apoint_llist_free (); - apoint_free_bkp (ERASE_FORCE); - recur_apoint_llist_free (); - recur_event_llist_free (); - recur_apoint_free_bkp (ERASE_FORCE); - recur_event_free_bkp (ERASE_FORCE); - todo_free_list (); - notify_free_app (); + free_user_data (); keys_free (); mem_stats (); if (was_interactive) @@ -104,6 +94,22 @@ exit_calcurse (int status) exit (status); } +void +free_user_data (void) +{ + day_free_list (); + event_llist_free (); + event_free_bkp (ERASE_FORCE); + apoint_llist_free (); + apoint_free_bkp (ERASE_FORCE); + recur_apoint_llist_free (); + recur_event_llist_free (); + recur_apoint_free_bkp (ERASE_FORCE); + recur_event_free_bkp (ERASE_FORCE); + todo_free_list (); + notify_free_app (); +} + /* Function to exit on internal error. */ void fatalbox (const char *errmsg) diff --git a/src/utils.h b/src/utils.h index 035f29a..3f5e36f 100755 --- a/src/utils.h +++ b/src/utils.h @@ -1,4 +1,4 @@ -/* $calcurse: utils.h,v 1.48 2009/07/23 18:33:22 culot Exp $ */ +/* $calcurse: utils.h,v 1.49 2009/07/27 19:35:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -124,6 +124,7 @@ typedef enum erase_flag_e; void exit_calcurse (int); +void free_user_data (void); void fatalbox (const char *); void warnbox (const char *); void status_mesg (char *, char *); -- cgit v1.2.3-70-g09d2