summaryrefslogtreecommitdiff
path: root/src/day.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-04-19 21:04:47 +0000
committerFrederic Culot <calcurse@culot.org>2008-04-19 21:04:47 +0000
commit2341c900035a5947fea7539c011ff6173ddc80ce (patch)
treee6dd95431f3797deb00aa178d0d60e61e01b3a17 /src/day.c
parent2e798df3cb498b0e2150a5c2ace47eb80281237e (diff)
downloadcalcurse-2341c900035a5947fea7539c011ff6173ddc80ce.zip
some memory leaks fixed using valgrind and some minor code cleanup
Diffstat (limited to 'src/day.c')
-rwxr-xr-xsrc/day.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/day.c b/src/day.c
index fcb8d6c..5986bb2 100755
--- a/src/day.c
+++ b/src/day.c
@@ -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)