Fix some memory leaks and use-after-free (cppcheck)
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user