Skip to content

Instantly share code, notes, and snippets.

@user-none
Created July 1, 2015 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save user-none/6c627e97f65a31c5bc1e to your computer and use it in GitHub Desktop.
Save user-none/6c627e97f65a31c5bc1e to your computer and use it in GitHub Desktop.
#include "s2n_test.h"
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <s2n.h>
#include "tls/s2n_connection.h"
int main(int argc, char **argv)
{
struct s2n_config *server_config;
size_t i;
BEGIN_TEST();
EXPECT_SUCCESS(setenv("S2N_ENABLE_CLIENT_MODE", "1", 0));
EXPECT_SUCCESS(s2n_init());
for (i=0; i<10000; i++) {
server_config = s2n_config_new();
if (server_config == NULL) {
printf("i=%zu, %s\n", i, strerror(errno));
break;
}
}
EXPECT_NOT_NULL(server_config);
END_TEST();
return 0;
}
Output on Ubuntu 14.04.2
Running s2n_mlock_fail.c ... i=916, Cannot allocate memory
FAILED
Valgrind shows:
==25588== HEAP SUMMARY:
==25588== in use at exit: 26,336 bytes in 533 blocks
==25588== total heap usage: 600 allocs, 67 frees, 34,977 bytes allocated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment