2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
12 #include <openssl/bio.h>
13 #include <openssl/crypto.h>
15 int main(int argc, char **argv)
17 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
22 p = getenv("OPENSSL_DEBUG_MEMORY");
23 if (p != NULL && strcmp(p, "on") == 0)
24 CRYPTO_set_mem_debug(1);
25 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
27 lost = OPENSSL_malloc(3);
29 fprintf(stderr, "OPENSSL_malloc failed\n");
33 if (argv[1] && strcmp(argv[1], "freeit") == 0) {
38 noleak = CRYPTO_mem_leaks_fp(stderr);
39 /* If -1 return value something bad happened */
42 return ((lost != NULL) ^ (noleak == 0));