mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
butc: Fix problems found by static analysis
Several static analysis tools have identified various problems: - use of uninitlized variables (scan-build) - missing checks to ensure *alloc was successful (infer) - possible memory leaks (scan-build, cppcheck) To resolve the above problems: - ensure variables are initialized to safe defaults - add checks to ensure *alloc was successful before using the memory - fix possible memory leaks by freeing memory This commit is a reorganization of commits developed by Pat Riehecky, who ran the static analysis tools and developed the fixes. Change-Id: Ic5e222e344df4d5a3e317fcbb2f30a09dce93793 Reviewed-on: https://gerrit.openafs.org/14679 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
parent
f987feab84
commit
ed81d57a5c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <afsconfig.h>
|
#include <afsconfig.h>
|
||||||
#include <afs/param.h>
|
#include <afs/param.h>
|
||||||
|
#include <afs/opr.h>
|
||||||
|
|
||||||
#include <roken.h>
|
#include <roken.h>
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ CreateNode(struct dumpNode **newNode)
|
|||||||
{
|
{
|
||||||
/* get space */
|
/* get space */
|
||||||
*newNode = calloc(1, sizeof(struct dumpNode));
|
*newNode = calloc(1, sizeof(struct dumpNode));
|
||||||
|
opr_Assert(*newNode != NULL);
|
||||||
|
|
||||||
(*newNode)->next = dumpQHeader->next;
|
(*newNode)->next = dumpQHeader->next;
|
||||||
dumpQHeader->next = *newNode;
|
dumpQHeader->next = *newNode;
|
||||||
|
@ -163,7 +163,7 @@ scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr,
|
|||||||
char *buffer[2];
|
char *buffer[2];
|
||||||
int hasdata[2], curr, prev;
|
int hasdata[2], curr, prev;
|
||||||
afs_uint32 chunkSize = 0;
|
afs_uint32 chunkSize = 0;
|
||||||
afs_int32 nbytes;
|
afs_int32 nbytes = 0;
|
||||||
afs_int32 code = 0;
|
afs_int32 code = 0;
|
||||||
afs_int32 rcode, tcode;
|
afs_int32 rcode, tcode;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user