xref: /freebsd/lib/libc/posix1e/acl_free.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
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 
32515d7c92SRobert Watson #include <sys/types.h>
337bd44e92SThomas Moestl #include "namespace.h"
34515d7c92SRobert Watson #include <sys/acl.h>
357bd44e92SThomas Moestl #include "un-namespace.h"
36515d7c92SRobert Watson #include <sys/errno.h>
37515d7c92SRobert Watson #include <stdlib.h>
38515d7c92SRobert Watson 
390f626307SChris D. Faulhaber /*
400f626307SChris D. Faulhaber  * acl_free() (23.4.12): free any releasable memory allocated to the
410f626307SChris D. Faulhaber  * ACL data object identified by obj_p.
420f626307SChris D. Faulhaber  */
43515d7c92SRobert Watson int
acl_free(void * obj_p)44515d7c92SRobert Watson acl_free(void *obj_p)
45515d7c92SRobert Watson {
46515d7c92SRobert Watson 
470f626307SChris D. Faulhaber 	if (obj_p) {
48515d7c92SRobert Watson 		free(obj_p);
490f626307SChris D. Faulhaber 		obj_p = NULL;
500f626307SChris D. Faulhaber 	}
510f626307SChris D. Faulhaber 
52515d7c92SRobert Watson 	return (0);
53515d7c92SRobert Watson }
54