1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libcli:security: Return early if there are no aces to duplicate

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Dec 12 22:18:52 CET 2018 on sn-devel-144
This commit is contained in:
Andreas Schneider 2018-12-12 10:21:25 +01:00 committed by Andreas Schneider
parent e7a8e4e643
commit 9c507e98f0

View File

@ -67,15 +67,20 @@ struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx,
return NULL;
}
*nacl = (struct security_acl) {
.revision = oacl->revision,
.size = oacl->size,
.num_aces = oacl->num_aces,
};
if (nacl->num_aces == 0) {
return nacl;
}
nacl->aces = (struct security_ace *)talloc_memdup (nacl, oacl->aces, sizeof(struct security_ace) * oacl->num_aces);
if ((nacl->aces == NULL) && (oacl->num_aces > 0)) {
if (nacl->aces == NULL) {
goto failed;
}
nacl->revision = oacl->revision;
nacl->size = oacl->size;
nacl->num_aces = oacl->num_aces;
return nacl;
failed: