xref: /freebsd/lib/libc/posix1e/acl_free.c (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
1515d7c92SRobert Watson /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d915a14eSPedro F. Giffuni  *
42de14c39SRobert Watson  * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
5515d7c92SRobert Watson  * All rights reserved.
6515d7c92SRobert Watson  *
7515d7c92SRobert Watson  * Redistribution and use in source and binary forms, with or without
8515d7c92SRobert Watson  * modification, are permitted provided that the following conditions
9515d7c92SRobert Watson  * are met:
10515d7c92SRobert Watson  * 1. Redistributions of source code must retain the above copyright
11515d7c92SRobert Watson  *    notice, this list of conditions and the following disclaimer.
12515d7c92SRobert Watson  * 2. Redistributions in binary form must reproduce the above copyright
13515d7c92SRobert Watson  *    notice, this list of conditions and the following disclaimer in the
14515d7c92SRobert Watson  *    documentation and/or other materials provided with the distribution.
15515d7c92SRobert Watson  *
16515d7c92SRobert Watson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17515d7c92SRobert Watson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18515d7c92SRobert Watson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19515d7c92SRobert Watson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20515d7c92SRobert Watson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21515d7c92SRobert Watson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22515d7c92SRobert Watson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23515d7c92SRobert Watson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24515d7c92SRobert Watson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25515d7c92SRobert Watson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26515d7c92SRobert Watson  * SUCH DAMAGE.
27515d7c92SRobert Watson  */
28515d7c92SRobert Watson /*
29515d7c92SRobert Watson  * acl_free -- free ACL objects from user memory
30515d7c92SRobert Watson  */
31515d7c92SRobert Watson 
32333fc21eSDavid E. O'Brien #include <sys/cdefs.h>
33333fc21eSDavid E. O'Brien __FBSDID("$FreeBSD$");
34333fc21eSDavid E. O'Brien 
35515d7c92SRobert Watson #include <sys/types.h>
367bd44e92SThomas Moestl #include "namespace.h"
37515d7c92SRobert Watson #include <sys/acl.h>
387bd44e92SThomas Moestl #include "un-namespace.h"
39515d7c92SRobert Watson #include <sys/errno.h>
40515d7c92SRobert Watson #include <stdlib.h>
41515d7c92SRobert Watson 
420f626307SChris D. Faulhaber /*
430f626307SChris D. Faulhaber  * acl_free() (23.4.12): free any releasable memory allocated to the
440f626307SChris D. Faulhaber  * ACL data object identified by obj_p.
450f626307SChris D. Faulhaber  */
46515d7c92SRobert Watson int
47515d7c92SRobert Watson acl_free(void *obj_p)
48515d7c92SRobert Watson {
49515d7c92SRobert Watson 
500f626307SChris D. Faulhaber 	if (obj_p) {
51515d7c92SRobert Watson 		free(obj_p);
520f626307SChris D. Faulhaber 		obj_p = NULL;
530f626307SChris D. Faulhaber 	}
540f626307SChris D. Faulhaber 
55515d7c92SRobert Watson 	return (0);
56515d7c92SRobert Watson }
57