Unchecked malloc fixes
[openssl.git] / apps / s_cb.c
index eef86cb77b46c04feb8c9484857e38e7bc8ed607..12f7b8cb031d433b6d72b65eb20708deff6d52f3 100644 (file)
@@ -460,8 +460,13 @@ int ssl_print_curves(BIO *out, SSL *s, int noshared)
     if (ncurves <= 0)
         return 1;
     curves = OPENSSL_malloc(ncurves * sizeof(int));
     if (ncurves <= 0)
         return 1;
     curves = OPENSSL_malloc(ncurves * sizeof(int));
+    if(!curves) {
+        BIO_puts(out, "Malloc error getting supported curves\n");
+        return 0;
+    }
     SSL_get1_curves(s, curves);
 
     SSL_get1_curves(s, curves);
 
+
     BIO_puts(out, "Supported Elliptic Curves: ");
     for (i = 0; i < ncurves; i++) {
         if (i)
     BIO_puts(out, "Supported Elliptic Curves: ");
     for (i = 0; i < ncurves; i++) {
         if (i)