From: Thomas Roessler Date: Fri, 6 Dec 2002 10:56:30 +0000 (+0000) Subject: Fixing a number of traditional malloc calls which have made their X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ef15d4fd1d5cdc033cc6a8098364eebf13d971f;p=neomutt Fixing a number of traditional malloc calls which have made their way into the code. --- diff --git a/curs_lib.c b/curs_lib.c index ae4f17e4b..e31acc73f 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -181,7 +181,7 @@ int mutt_yesorno (const char *msg, int def) * ensure there is enough room for the answer and truncate the question * to fit. */ - answer_string = malloc (COLS + 1); + answer_string = safe_malloc (COLS + 1); snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def ? yes : no, def ? no : yes); answer_string_len = strlen (answer_string); printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); diff --git a/pgppubring.c b/pgppubring.c index 7dd3a4455..9c03603dc 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -763,10 +763,10 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh size_t error_buf_len; error_buf_len = sizeof ("fopen: ") - 1 + strlen (ringfile) + 1; - error_buf = malloc (error_buf_len); + error_buf = safe_malloc (error_buf_len); snprintf (error_buf, error_buf_len, "fopen: %s", ringfile); perror (error_buf); - free (error_buf); + safe_free (&error_buf); return; }