mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-06 17:25:16 +00:00
libapparmor: Remove casts while allocating memory
The libapparmor library is built with gcc, while the parser is built with g++. The parser code needs to cast pointers returned from the malloc(3) family of calls. However, code removed from the parser to libapparmor can drop the casts. Signed-off-by: Tyler Hicks <tyhicks@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -159,7 +159,7 @@ static int write_policy_fd_to_iface(aa_kernel_interface *kernel_interface,
|
||||
|
||||
do {
|
||||
if (asize - size == 0) {
|
||||
buffer = (char *) realloc(buffer, chunksize);
|
||||
buffer = realloc(buffer, chunksize);
|
||||
asize = chunksize;
|
||||
chunksize <<= 1;
|
||||
if (!buffer) {
|
||||
@@ -213,7 +213,7 @@ int aa_kernel_interface_new(aa_kernel_interface **kernel_interface,
|
||||
|
||||
*kernel_interface = NULL;
|
||||
|
||||
ki = (aa_kernel_interface *) calloc(1, sizeof(*ki));
|
||||
ki = calloc(1, sizeof(*ki));
|
||||
if (!ki) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user