diff options
author | Frederic Culot <calcurse@culot.org> | 2008-04-19 21:04:47 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2008-04-19 21:04:47 +0000 |
commit | 2341c900035a5947fea7539c011ff6173ddc80ce (patch) | |
tree | e6dd95431f3797deb00aa178d0d60e61e01b3a17 /src/day.c | |
parent | 2e798df3cb498b0e2150a5c2ace47eb80281237e (diff) | |
download | calcurse-2341c900035a5947fea7539c011ff6173ddc80ce.zip |
some memory leaks fixed using valgrind and some minor code cleanup
Diffstat (limited to 'src/day.c')
-rwxr-xr-x | src/day.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.36 2008/04/12 21:14:03 culot Exp $ */ +/* $calcurse: day.c,v 1.37 2008/04/19 21:05:15 culot Exp $ */ /* * Calcurse - text-based organizer @@ -91,8 +91,7 @@ day_add_apoint (int type, char *mesg, char *note, long start, long dur, int insert_item = 0; o = (struct day_item_s *) malloc (sizeof (struct day_item_s)); - o->mesg = (char *) malloc (strlen (mesg) + 1); - strncpy (o->mesg, mesg, strlen (mesg) + 1); + o->mesg = strdup (mesg); o->note = note; o->start = start; o->appt_dur = dur; @@ -398,9 +397,7 @@ day_write_pad (long date, int width, int length, int incolor) /* Initialize the structure used to store highlited item. */ if (day_saved_item == NULL) { - day_saved_item = (struct day_saved_item_s *) - malloc (sizeof (struct day_saved_item_s)); - day_saved_item->mesg = (char *) malloc (sizeof (char)); + day_saved_item = malloc (sizeof (struct day_saved_item_s)); } for (p = day_items_ptr; p != 0; p = p->next) |