1*ffae97bbSchristos /* $NetBSD: freezero.c,v 1.1 2018/04/06 18:59:00 christos Exp $ */
2*ffae97bbSchristos /*
3*ffae97bbSchristos * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
4*ffae97bbSchristos *
5*ffae97bbSchristos * Permission to use, copy, modify, and distribute this software for any
6*ffae97bbSchristos * purpose with or without fee is hereby granted, provided that the above
7*ffae97bbSchristos * copyright notice and this permission notice appear in all copies.
8*ffae97bbSchristos *
9*ffae97bbSchristos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*ffae97bbSchristos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*ffae97bbSchristos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*ffae97bbSchristos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*ffae97bbSchristos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*ffae97bbSchristos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*ffae97bbSchristos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*ffae97bbSchristos */
17*ffae97bbSchristos
18*ffae97bbSchristos #include "includes.h"
19*ffae97bbSchristos __RCSID("$NetBSD: freezero.c,v 1.1 2018/04/06 18:59:00 christos Exp $");
20*ffae97bbSchristos
21*ffae97bbSchristos #include <string.h>
22*ffae97bbSchristos #include <stdlib.h>
23*ffae97bbSchristos
24*ffae97bbSchristos #ifndef HAVE_FREEZERO
25*ffae97bbSchristos
26*ffae97bbSchristos void
freezero(void * ptr,size_t sz)27*ffae97bbSchristos freezero(void *ptr, size_t sz)
28*ffae97bbSchristos {
29*ffae97bbSchristos if (ptr == NULL)
30*ffae97bbSchristos return;
31*ffae97bbSchristos explicit_bzero(ptr, sz);
32*ffae97bbSchristos free(ptr);
33*ffae97bbSchristos }
34*ffae97bbSchristos
35*ffae97bbSchristos #endif /* HAVE_FREEZERO */
36*ffae97bbSchristos
37