Cleanup vxworks support to be able to compile for VxWorks 7
[openssl.git] / ssl / packet.c
index 7c4be4fee5badeb29edf82f3857aa5ed5fd86088..95031430ed6687637257f74f365f351b48520c30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,8 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "e_os.h"
+#include "internal/cryptlib.h"
 #include "packet_locl.h"
+#include <openssl/sslerr.h>
 
 #define DEFAULT_BUF_SIZE    256
 
@@ -93,9 +94,10 @@ static int wpacket_intern_init_len(WPACKET *pkt, size_t lenbytes)
     pkt->curr = 0;
     pkt->written = 0;
 
-    pkt->subs = OPENSSL_zalloc(sizeof(*pkt->subs));
-    if (pkt->subs == NULL)
+    if ((pkt->subs = OPENSSL_zalloc(sizeof(*pkt->subs))) == NULL) {
+        SSLerr(SSL_F_WPACKET_INTERN_INIT_LEN, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     if (lenbytes == 0)
         return 1;
@@ -276,9 +278,10 @@ int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
     if (!ossl_assert(pkt->subs != NULL))
         return 0;
 
-    sub = OPENSSL_zalloc(sizeof(*sub));
-    if (sub == NULL)
+    if ((sub = OPENSSL_zalloc(sizeof(*sub))) == NULL) {
+        SSLerr(SSL_F_WPACKET_START_SUB_PACKET_LEN__, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     sub->parent = pkt->subs;
     pkt->subs = sub;