Fix some memory leaks and use-after-free (cppcheck)

This commit is contained in:
Douglas Clowes
2014-03-03 17:18:52 +11:00
parent be347e813c
commit 9e65849964
6 changed files with 34 additions and 18 deletions

View File

@@ -278,6 +278,11 @@ int ANSTO_SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object
pSICSOBJ obj = NULL;
hdbCallback *cb;
if(argc < 4){
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
return 0;
}
pNew = SCTDRIVMakeObject();
if(pNew == NULL){
SCWrite(pCon,"ERROR: out of memory in ANSTO_SctMakeDriveAdapter",
@@ -285,11 +290,6 @@ int ANSTO_SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object
return 0;
}
if(argc < 4){
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
return 0;
}
pNew->write_node = FindHdbNode(NULL,argv[2], pCon);
pNew->read_node = FindHdbNode(NULL,argv[3], pCon);
obj = FindCommandData(pSics,argv[4], "SctController");