Change malloc to calloc

pull/1095/head
Mike Black W9MDB 2022-07-27 10:08:29 -05:00
rodzic 027b3ee0a5
commit dd3208ad34
6 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -56,7 +56,7 @@ static int dummy_amp_init(AMP *amp)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
amp->state.priv = (struct dummy_amp_priv_data *)
malloc(sizeof(struct dummy_amp_priv_data));
calloc(1,sizeof(struct dummy_amp_priv_data));
if (!amp->state.priv)
{

Wyświetl plik

@ -613,7 +613,7 @@ static int flrig_init(RIG *rig)
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
rig->state.priv = (struct flrig_priv_data *)malloc(sizeof(
rig->state.priv = (struct flrig_priv_data *)calloc(1,sizeof(
struct flrig_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -168,7 +168,7 @@ static int netrigctl_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct netrigctl_priv_data *)malloc(sizeof(
rig->state.priv = (struct netrigctl_priv_data *)calloc(1,sizeof(
struct netrigctl_priv_data));
if (!rig->state.priv)
@ -2387,7 +2387,7 @@ static int netrigctl_send_dtmf(RIG *rig, vfo_t vfo, const char *digits)
// allocate memory for size of (cmd + digits + \n + \0)
len = strlen(cmd) + strlen(digits) + 2;
cmdp = malloc(len);
cmdp = calloc(1,len);
if (cmdp == NULL)
{
@ -2470,7 +2470,7 @@ static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg)
// allocate memory for size of (cmd + msg + \n + \0)
len = strlen(cmd) + strlen(msg) + 2;
cmdp = malloc(len);
cmdp = calloc(1,len);
if (cmdp == NULL)
{

Wyświetl plik

@ -121,7 +121,7 @@ static int dummy_rot_init(ROT *rot)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot->state.priv = (struct dummy_rot_priv_data *)
malloc(sizeof(struct dummy_rot_priv_data));
calloc(1,sizeof(struct dummy_rot_priv_data));
if (!rot->state.priv)
{

Wyświetl plik

@ -424,7 +424,7 @@ static int tci1x_init(RIG *rig)
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
rig->state.priv = (struct tci1x_priv_data *)malloc(sizeof(
rig->state.priv = (struct tci1x_priv_data *)calloc(1,sizeof(
struct tci1x_priv_data));
if (!rig->state.priv)

Wyświetl plik

@ -262,7 +262,7 @@ static int trxmanager_init(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
rig->state.priv = (struct trxmanager_priv_data *)malloc(
rig->state.priv = (struct trxmanager_priv_data *)calloc(1,
sizeof(struct trxmanager_priv_data));
if (!rig->state.priv)