Fix some memory leaks and use-after-free (cppcheck)
This commit is contained in:
@@ -286,12 +286,15 @@
|
||||
}
|
||||
|
||||
pNew = CreateEVDriver(argc,argv);
|
||||
pSim = (pLAKESHORE340Driv)malloc(sizeof(LAKESHORE340Driv));
|
||||
memset(pSim,0,sizeof(LAKESHORE340Driv));
|
||||
if(!pNew || !pSim)
|
||||
{
|
||||
if (!pNew) {
|
||||
return NULL;
|
||||
}
|
||||
pSim = (pLAKESHORE340Driv)malloc(sizeof(LAKESHORE340Driv));
|
||||
if (!pSim) {
|
||||
free(pNew);
|
||||
return NULL;
|
||||
}
|
||||
memset(pSim,0,sizeof(LAKESHORE340Driv));
|
||||
pNew->pPrivate = pSim;
|
||||
pNew->KillPrivate = KillLAKESHORE340;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user