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;
|
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! */
|
/* whoops! memory shortage! */
|
||||||
return -RIG_ENOMEM;
|
return -RIG_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv = rig->state.priv;
|
||||||
|
|
||||||
/* Try to load required dll */
|
/* Try to load required dll */
|
||||||
priv->dll = LoadLibrary(DWTDLL);
|
priv->dll = LoadLibrary(DWTDLL);
|
||||||
|
|
||||||
|
@ -244,10 +246,12 @@ int dwtdll_init(RIG *rig)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n",
|
rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n",
|
||||||
__func__, DWTDLL);
|
__func__, DWTDLL);
|
||||||
free(priv);
|
free(rig->state.priv);
|
||||||
return -RIG_EIO; /* huh! */
|
return -RIG_EIO; /* huh! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Get process addresses from dll for function access */
|
/* Get process addresses from dll for function access */
|
||||||
priv->FrontendOpen =
|
priv->FrontendOpen =
|
||||||
(FNCFrontendOpen) GetProcAddress(priv->dll, "FrontendOpen");
|
(FNCFrontendOpen) GetProcAddress(priv->dll, "FrontendOpen");
|
||||||
|
@ -288,8 +292,6 @@ int dwtdll_init(RIG *rig)
|
||||||
priv->FrontendGetFmMode =
|
priv->FrontendGetFmMode =
|
||||||
(FNCFrontendGetFmMode) GetProcAddress(priv->dll, "FrontendGetFmMode");
|
(FNCFrontendGetFmMode) GetProcAddress(priv->dll, "FrontendGetFmMode");
|
||||||
|
|
||||||
rig->state.priv = (void *)priv;
|
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue