Coverage Report

Created: 2024-05-20 01:00

/src/openiked-portable/compat/freezero.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
3
 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
4
 * Copyright (c) 2008 Damien Miller <djm@openbsd.org>
5
 * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
6
 *
7
 * Permission to use, copy, modify, and distribute this software for any
8
 * purpose with or without fee is hereby granted, provided that the above
9
 * copyright notice and this permission notice appear in all copies.
10
 *
11
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
 */
19
20
#include <string.h>
21
#include <stdlib.h>
22
23
void
24
freezero(void *ptr, size_t sz)
25
26.9k
{
26
  /* This is legal. */
27
26.9k
  if (ptr == NULL)
28
1.89k
    return;
29
30
25.0k
  explicit_bzero(ptr, sz);
31
25.0k
  free(ptr);
32
25.0k
}