openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libcap/2.27-r0/libcap-2.27/libcap/cap_alloc.c
int cap_free(void* data_p)
{
    if (!data_p)
        return 0;

    if (good_cap_t(data_p))
    {
        data_p = -1 + (__u32*)data_p;
        memset(data_p, 0, sizeof(__u32) + sizeof(struct _cap_struct));
        free(data_p);
        data_p = NULL;
        return 0;
    }

    if (good_cap_string(data_p))
    {
        size_t length = strlen(data_p) + sizeof(__u32);
        data_p = -1 + (__u32*)data_p;
        memset(data_p, 0, length);
        free(data_p);
        data_p = NULL;
        return 0;
    }

    _cap_debug("don't recognize what we're supposed to liberate");
    errno = EINVAL;
    return -1;
}
/*
 * Scrub and then liberate an internal capability set.
 */
Scrub and then liberate an internal capability set.
Scrub and then liberate an internal capability set .
int cap_free(void* data_p)
{
    if (!data_p)
        return 0;
    if (good_cap_t(data_p))
    {
        data_p = -1 + (__u32*)data_p;
        memset(data_p, 0, sizeof(__u32) + sizeof(struct _cap_struct));
        free(data_p);
        data_p = NULL;
        return 0;
    }
    if (good_cap_string(data_p))
    {
        size_t length = strlen(data_p) + sizeof(__u32);
        data_p = -1 + (__u32*)data_p;
        memset(data_p, 0, length);
        free(data_p);
        data_p = NULL;
        return 0;
    }
    _cap_debug("don't recognize what we're supposed to liberate");
    errno = EINVAL;
    return -1;
}
int cap_free ( void * data_p ) { if ( ! data_p ) return 0 ; if ( good_cap_t ( data_p ) ) { data_p = -1 + ( __u32 * ) data_p ; memset ( data_p , 0 , sizeof ( __u32 ) + sizeof ( struct _cap_struct ) ) ; free ( data_p ) ; data_p = NULL ; return 0 ; } if ( good_cap_string ( data_p ) ) { size_t length = strlen ( data_p ) + sizeof ( __u32 ) ; data_p = -1 + ( __u32 * ) data_p ; memset ( data_p , 0 , length ) ; free ( data_p ) ; data_p = NULL ; return 0 ; } _cap_debug ( " " ) ; errno = EINVAL ; return -1 ; }
Scrub and then liberate an internal capability set.
Scrub and then liberate an internal capability set .