summaryrefslogtreecommitdiff
path: root/source4/torture/gentest.c
diff options
context:
space:
mode:
authorBill Parker <wp02855@gmail.com>2013-07-17 15:30:35 -0700
committerJeremy Allison <jra@samba.org>2013-07-17 16:12:19 -0700
commit9b58da986680a92b350f02cd31ff64f30fecd07c (patch)
tree3a9bd6255f1f1c06f8812fd68f1be984add69ea0 /source4/torture/gentest.c
parent9b2aa351ceb756d6ea63f3158f0e983ae7262da8 (diff)
downloadsamba-9b58da986680a92b350f02cd31ff64f30fecd07c.tar.gz
Fix bug 10025 - Lack of Sanity Checking in calls to malloc()/calloc().
In reviewing various files in Samba-4.0.7, I found a number of instances where malloc()/calloc() were called without the checking the return value for a value of NULL, which would indicate failure. (NB. The changes needed to ccan, iniparser, popt and heimdal will be reported upstream, not patched inside Samba). Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Source <idra@samba.org>
Diffstat (limited to 'source4/torture/gentest.c')
-rw-r--r--source4/torture/gentest.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 91b60e2c4e7..f3c4c20e531 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -3068,9 +3068,17 @@ static bool start_gentest(struct tevent_context *ev,
/* allocate the open_handles array */
open_handles = calloc(options.max_open_handles, sizeof(open_handles[0]));
+ if (open_handles == NULL) {
+ printf("Unable to allocate memory for open_handles array.\n");
+ exit(1);
+ }
srandom(options.seed);
op_parms = calloc(options.numops, sizeof(op_parms[0]));
+ if (op_parms == NULL) {
+ printf("Unable to allocate memory for op_parms.\n");
+ exit(1);
+ }
/* generate the seeds - after this everything is deterministic */
if (options.use_preset_seeds) {