Blame tests/ocsp-filename-memleak.c

Packit Service 4684c1
/*
Packit Service 4684c1
 * Copyright (C) 2016 Attila Molnar
Packit Service 4684c1
 * Copyright (C) 2013-2016 Nikos Mavrogiannopoulos
Packit Service 4684c1
 * Copyright (C) 2016 Red Hat, Inc.
Packit Service 4684c1
 *
Packit Service 4684c1
 * This file is part of GnuTLS.
Packit Service 4684c1
 *
Packit Service 4684c1
 * GnuTLS is free software; you can redistribute it and/or modify it
Packit Service 4684c1
 * under the terms of the GNU General Public License as published by
Packit Service 4684c1
 * the Free Software Foundation; either version 3 of the License, or
Packit Service 4684c1
 * (at your option) any later version.
Packit Service 4684c1
 *
Packit Service 4684c1
 * GnuTLS is distributed in the hope that it will be useful, but
Packit Service 4684c1
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 4684c1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 4684c1
 * General Public License for more details.
Packit Service 4684c1
 *
Packit Service 4684c1
 * You should have received a copy of the GNU General Public License
Packit Service 4684c1
 * along with GnuTLS; if not, write to the Free Software Foundation,
Packit Service 4684c1
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Packit Service 4684c1
 */
Packit Service 4684c1
Packit Service 4684c1
/* This program tests if gnutls_certificate_set_ocsp_status_request_file()
Packit Service 4684c1
 * leaks memory if called more than once with the same credentials.
Packit Service 4684c1
 */
Packit Service 4684c1
Packit Service 4684c1
#ifdef HAVE_CONFIG_H
Packit Service 4684c1
#include <config.h>
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#include <stdio.h>
Packit Service 4684c1
#include <stdlib.h>
Packit Service 4684c1
#include <gnutls/gnutls.h>
Packit Service 4684c1
Packit Service 4684c1
#include "utils.h"
Packit Service 4684c1
Packit Service 4684c1
#if !defined(ENABLE_OCSP)
Packit Service 4684c1
Packit Service 4684c1
int main(int argc, char **argv)
Packit Service 4684c1
{
Packit Service 4684c1
	exit(77);
Packit Service 4684c1
}
Packit Service 4684c1
Packit Service 4684c1
#else
Packit Service 4684c1
Packit Service 4684c1
void doit(void)
Packit Service 4684c1
{
Packit Service 4684c1
	gnutls_certificate_credentials_t x509_cred;
Packit Service 4684c1
Packit Service 4684c1
	gnutls_certificate_allocate_credentials(&x509_cred);
Packit Service 4684c1
	/* The file does not need to exist for this test
Packit Service 4684c1
	 */
Packit Service 4684c1
	gnutls_certificate_set_ocsp_status_request_file
Packit Service 4684c1
	    (x509_cred, "ocsp-status.der", 0);
Packit Service 4684c1
	gnutls_certificate_set_ocsp_status_request_file
Packit Service 4684c1
	    (x509_cred, "ocsp-status.der", 0);
Packit Service 4684c1
Packit Service 4684c1
	gnutls_certificate_free_credentials(x509_cred);
Packit Service 4684c1
}
Packit Service 4684c1
Packit Service 4684c1
#endif