kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warning in dwt.c
rodzic
284e8bacfd
commit
e6cf0be165
12
kit/dwt.c
12
kit/dwt.c
|
@ -229,14 +229,16 @@ int dwtdll_init(RIG *rig)
|
|||
{
|
||||
struct dwtdll_priv_data *priv;
|
||||
|
||||
priv = (struct dwtdll_priv_data *)malloc(sizeof(struct dwtdll_priv_data));
|
||||
rig->state.priv = (struct dwtdll_priv_data *)malloc(sizeof(struct dwtdll_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
/* Try to load required dll */
|
||||
priv->dll = LoadLibrary(DWTDLL);
|
||||
|
||||
|
@ -244,10 +246,12 @@ int dwtdll_init(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n",
|
||||
__func__, DWTDLL);
|
||||
free(priv);
|
||||
free(rig->state.priv);
|
||||
return -RIG_EIO; /* huh! */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Get process addresses from dll for function access */
|
||||
priv->FrontendOpen =
|
||||
(FNCFrontendOpen) GetProcAddress(priv->dll, "FrontendOpen");
|
||||
|
@ -288,8 +292,6 @@ int dwtdll_init(RIG *rig)
|
|||
priv->FrontendGetFmMode =
|
||||
(FNCFrontendGetFmMode) GetProcAddress(priv->dll, "FrontendGetFmMode");
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue