HTTP and HTTPS library for Mbed OS 5

Dependents:   RZ_A2M_Mbed_samples_20201012 RZ_A2M_Mbed_samples

Revision:
18:f7a85895a941
Parent:
15:ffc77f212382
Child:
29:383e9bfbfbed
Child:
31:b3730a2c4f39
--- a/source/http_response.h	Mon Jul 31 15:36:33 2017 +0200
+++ b/source/http_response.h	Mon Sep 04 16:31:38 2017 +0100
@@ -142,7 +142,13 @@
                 body = (char*)malloc(length);
             }
             else {
+                char* original_body = body;
                 body = (char*)realloc(body, body_offset + length);
+                if (body == NULL) {
+                    printf("[HttpResponse] realloc for %d bytes failed\n", body_offset + length);
+                    free(original_body);
+                    return;
+                }
             }
         }