diff options
author | Bill Parker <wp02855@gmail.com> | 2013-07-17 15:30:35 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-07-17 16:12:19 -0700 |
commit | 9b58da986680a92b350f02cd31ff64f30fecd07c (patch) | |
tree | 3a9bd6255f1f1c06f8812fd68f1be984add69ea0 /lib/tdb/tools | |
parent | 9b2aa351ceb756d6ea63f3158f0e983ae7262da8 (diff) | |
download | samba-9b58da986680a92b350f02cd31ff64f30fecd07c.tar.gz samba-9b58da986680a92b350f02cd31ff64f30fecd07c.tar.bz2 samba-9b58da986680a92b350f02cd31ff64f30fecd07c.zip |
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 'lib/tdb/tools')
-rw-r--r-- | lib/tdb/tools/tdbtorture.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c index a23d1543e5..5ae08f662a 100644 --- a/lib/tdb/tools/tdbtorture.c +++ b/lib/tdb/tools/tdbtorture.c @@ -342,7 +342,15 @@ int main(int argc, char * const *argv) } pids = (pid_t *)calloc(sizeof(pid_t), num_procs); + if (pids == NULL) { + perror("Unable to allocate memory for pids"); + exit(1); + } done = (int *)calloc(sizeof(int), num_procs); + if (done == NULL) { + perror("Unable to allocate memory for done"); + exit(1); + } if (pipe(pfds) != 0) { perror("Creating pipe"); |