calendar: replace strcpy/strcat with asprintf
This commit is contained in:
parent
89b859e39a
commit
65d4f317ea
@ -86,12 +86,9 @@ event_continue(struct event *e, char *txt)
|
||||
errx(1, "event_continue: cannot allocate memory");
|
||||
|
||||
free(e->text);
|
||||
e->text = (char *)malloc(strlen(text) + strlen(txt) + 3);
|
||||
asprintf(&e->text, "%s\n%s", text, txt);
|
||||
if (e->text == NULL)
|
||||
errx(1, "event_continue: cannot allocate memory");
|
||||
strcpy(e->text, text);
|
||||
strcat(e->text, "\n");
|
||||
strcat(e->text, txt);
|
||||
free(text);
|
||||
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user