diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-04 11:28:38 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-18 10:47:15 +0100 |
commit | 6ef020c988bb508842dfcd517a4b41cae214f641 (patch) | |
tree | c7cbc8c5fc0456b157c02c0a97fae580dab81b15 /crypto/ui | |
parent | 24854e0117000b81319665154c93e15743bf7de6 (diff) | |
download | openssl-6ef020c988bb508842dfcd517a4b41cae214f641.tar.gz |
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 <levitte@openssl.org>
Diffstat (limited to 'crypto/ui')
-rw-r--r-- | crypto/ui/ui_lib.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; } |