If orig_share is NULL, the program will jump to the done label, where the
lpcfg_set_cmdline function will be called without any checks; within that
function, no checks are performed either, and orig_share will be dereferenced.
Added a check if (orig_share != NULL) before calling lpcfg_set_cmdline
in the cleanup block.
Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Shumikhina Ksenia <shumikhinaka@sgu.ru>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 13 09:25:05 UTC 2026 on atb-devel-224
}
/* Set sharename back. */
- lpcfg_set_cmdline(tctx->lp_ctx, "torture:share", orig_share);
+ if (orig_share != NULL) {
+ lpcfg_set_cmdline(tctx->lp_ctx, "torture:share", orig_share);
+ }
talloc_free(mem_ctx);