The branch, master has been updated
via 942f407337b source3/printing: Fix CID 1273086 - Resource Leak
from 6d86e6e8919 coverity: Add some additional check for strequal()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 942f407337bb99c3d8de77f478e001f8357f8594
Author: Shwetha K Acharya <[email protected]>
Date: Thu Jul 31 18:29:05 2025 +0530
source3/printing: Fix CID 1273086 - Resource Leak
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 <[email protected]>
Reviewed-by: Guenther Deschner <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
Reviewed-by: Vinit Agnihotri <[email protected]>
Autobuild-User(master): Anoop C S <[email protected]>
Autobuild-Date(master): Tue Aug 5 09:20:17 UTC 2025 on atb-devel-224
-----------------------------------------------------------------------
Summary of changes:
source3/printing/print_generic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index a8bf9aff972..d5bfa9ea527 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -225,7 +225,7 @@ static int generic_job_submit(int snum, struct printjob
*pjob,
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
@@ -299,7 +299,6 @@ static int generic_job_submit(int snum, struct printjob
*pjob,
break;
}
}
- SAFE_FREE(q);
ret = 0;
}
if (pjob->sysjob == -1) {
@@ -313,6 +312,7 @@ static int generic_job_submit(int snum, struct printjob
*pjob,
if (chdir(current_directory) == -1) {
smb_panic("chdir failed in generic_job_submit");
}
+ SAFE_FREE(q);
TALLOC_FREE(current_directory);
return ret;
}
--
Samba Shared Repository