1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3/utils: Check return of talloc_strdup

followup to e82699fcca

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15205

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Noel Power 2022-10-17 10:25:00 +01:00 committed by Jeremy Allison
parent 19eb88bc53
commit 972127dadd

View File

@ -1149,8 +1149,16 @@ int main(int argc, const char **argv)
poptGetArg(pc); /* Drop argv[0], the program name */
if (user_name == NULL)
user_name = talloc_strdup(frame, poptGetArg(pc));
if (user_name == NULL) {
if (poptPeekArg(pc)) {
user_name = talloc_strdup(frame, poptGetArg(pc));
if (user_name == NULL) {
fprintf(stderr, "out of memory\n");
TALLOC_FREE(frame);
exit(1);
}
}
}
setparms = (backend ? BIT_BACKEND : 0) +
(verbose ? BIT_VERBOSE : 0) +