The branch, master has been updated
via affb734a256 tdbtorture: Fix CID 1034816: proper calloc usage
from d4d231dc50f nsswitch/libwbclient: Fix CID #1034862 Resource leak
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit affb734a2568a342e443872ae6c789ef03f5faa6
Author: Shachar Sharon <[email protected]>
Date: Tue Aug 19 12:18:28 2025 +0300
tdbtorture: Fix CID 1034816: proper calloc usage
Standard signature is 'calloc(n_elems, elem_size)', where element size
(in particular, when using 'sizeof') comes as 2nd arg. The actual
allocation size does not care for ordering but swapping the order
confuses static-analysis tools like Coverity, as well as naive readers.
Signed-off-by: Shachar Sharon <[email protected]>
Reviewed-by: Vinit Agnihotri <[email protected]>
Reviewed-by: Shweta Sodani <[email protected]>
Reviewed-by: Rabinarayan Panigrahi <[email protected]>
Reviewed-by: Anoop C S <[email protected]>
Reviewed-by: Guenther Deschner <[email protected]>
Reviewed-by: Volker Lendecke <[email protected]>
Autobuild-User(master): Günther Deschner <[email protected]>
Autobuild-Date(master): Tue Aug 19 18:08:02 UTC 2025 on atb-devel-224
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/tools/tdbtorture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c
index 1063f14f4cc..14dc5e7a8d1 100644
--- a/lib/tdb/tools/tdbtorture.c
+++ b/lib/tdb/tools/tdbtorture.c
@@ -374,12 +374,12 @@ int main(int argc, char * const *argv)
goto done;
}
- pids = (pid_t *)calloc(sizeof(pid_t), num_procs);
+ pids = (pid_t *)calloc(num_procs, sizeof(pid_t));
if (pids == NULL) {
perror("Unable to allocate memory for pids");
exit(1);
}
- done = (int *)calloc(sizeof(int), num_procs);
+ done = (int *)calloc(num_procs, sizeof(int));
if (done == NULL) {
perror("Unable to allocate memory for done");
exit(1);
--
Samba Shared Repository