kernel: newGroups was allocated with malloc, deallocate with free()

fix gcc analyzer warning

Change-Id: I0427a3d9b288e081055242fff59f2e15e478dac6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7904
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
Jérôme Duval
2024-07-26 16:14:04 +00:00
committed by waddlesplash
parent e21d313387
commit 9d18e52191
+2 -3
View File
@@ -224,9 +224,8 @@ common_setgroups(int groupCount, const gid_t* groupList, bool kernel)
memcpy(newGroups->groups, groupList, sizeof(gid_t) * groupCount);
} else {
if (!IS_USER_ADDRESS(groupList)
|| user_memcpy(newGroups->groups, groupList,
sizeof(gid_t) * groupCount) != B_OK) {
delete newGroups;
|| user_memcpy(newGroups->groups, groupList, sizeof(gid_t) * groupCount) != B_OK) {
free(newGroups);
return B_BAD_ADDRESS;
}
}