summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples/ex-ocsp-client.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/examples/ex-ocsp-client.c b/doc/examples/ex-ocsp-client.c
index f0b56fffe2..d675e77862 100644
--- a/doc/examples/ex-ocsp-client.c
+++ b/doc/examples/ex-ocsp-client.c
@@ -91,6 +91,10 @@ int main(int argc, char *argv[])
tmp.data);
hostname = malloc(tmp.size + 1);
+ if (!hostname) {
+ fprintf(stderr, "error: cannot allocate memory\n");
+ exit(1);
+ }
memcpy(hostname, tmp.data, tmp.size);
hostname[tmp.size] = 0;