From 6ef020c988bb508842dfcd517a4b41cae214f641 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 4 May 2016 11:28:38 +0100 Subject: Better checks for malloc failure in various METHOD functions A number of the METHOD functions weren't properly handling malloc failures. Reviewed-by: Richard Levitte --- crypto/ui/ui_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crypto/ui') diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c index a5d8aac064..3d0df5140d 100644 --- a/crypto/ui/ui_lib.c +++ b/crypto/ui/ui_lib.c @@ -536,8 +536,13 @@ UI_METHOD *UI_create_method(char *name) { UI_METHOD *ui_method = OPENSSL_zalloc(sizeof(*ui_method)); - if (ui_method != NULL) + if (ui_method != NULL) { ui_method->name = OPENSSL_strdup(name); + if (ui_method->name == NULL) { + OPENSSL_free(ui_method); + return NULL; + } + } return ui_method; } -- cgit v1.2.3