Ensure print_queue_struct *q is initialized to NULL to avoid
undefined behavior when freeing on error paths. Move SAFE_FREE(q)
outside the ret > 0 block to ensure q is always freed.
Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Aug 5 09:20:17 UTC 2025 on atb-devel-224
char *jobname = NULL;
TALLOC_CTX *ctx = talloc_tos();
fstring job_page_count, job_size;
- print_queue_struct *q;
+ print_queue_struct *q = NULL;
print_status_struct status;
/* we print from the directory path to give the best chance of
break;
}
}
- SAFE_FREE(q);
ret = 0;
}
if (pjob->sysjob == -1) {
if (chdir(current_directory) == -1) {
smb_panic("chdir failed in generic_job_submit");
}
+ SAFE_FREE(q);
TALLOC_FREE(current_directory);
return ret;
}