local variable 't' is reusing in child process, resulting the leaking
the tfork object as a side effect.
This fixes coverity issue#
1414760
Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Shachar Sharon <ssharon@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Aug 12 09:32:19 UTC 2025 on atb-devel-224
}
child = tfork_child_pid(t);
if (child == 0) {
+ struct tfork *t1 = NULL;
+
close(up[0]);
- t = tfork_create();
- if (t == NULL) {
+ t1 = tfork_create();
+ if (t1 == NULL) {
torture_fail(tctx, "tfork failed\n");
return false;
}
- child = tfork_child_pid(t);
+ child = tfork_child_pid(t1);
if (child == 0) {
sleep(1);
pid = getpid();
_exit(1);
}
+ status = tfork_status(&t1, true);
+ torture_assert_goto(tctx, status != -1, ok, done, "tfork_status failed\n");
_exit(0);
}