summaryrefslogtreecommitdiff
path: root/ospfclient/ospf_apiclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfclient/ospf_apiclient.c')
-rw-r--r--ospfclient/ospf_apiclient.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index fb8ad3e60a..d4f0dc953c 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -565,6 +565,7 @@ static void ospf_apiclient_handle_lsa_update(struct ospf_apiclient *oclient,
{
struct msg_lsa_change_notify *cn;
struct lsa_header *lsa;
+ void *p;
uint16_t lsalen;
cn = (struct msg_lsa_change_notify *)STREAM_DATA(msg->s);
@@ -578,9 +579,11 @@ static void ospf_apiclient_handle_lsa_update(struct ospf_apiclient *oclient,
__func__, lsalen, OSPF_MAX_LSA_SIZE);
return;
}
- lsa = XMALLOC(MTYPE_OSPF_APICLIENT, lsalen);
- memcpy(lsa, &(cn->data), lsalen);
+ p = XMALLOC(MTYPE_OSPF_APICLIENT, lsalen);
+
+ memcpy(p, &(cn->data), lsalen);
+ lsa = p;
/* Invoke registered update callback function */
if (oclient->update_notify) {
@@ -589,7 +592,7 @@ static void ospf_apiclient_handle_lsa_update(struct ospf_apiclient *oclient,
}
/* free memory allocated by ospf apiclient library */
- XFREE(MTYPE_OSPF_APICLIENT, lsa);
+ XFREE(MTYPE_OSPF_APICLIENT, p);
}
static void ospf_apiclient_handle_lsa_delete(struct ospf_apiclient *oclient,
@@ -597,6 +600,7 @@ static void ospf_apiclient_handle_lsa_delete(struct ospf_apiclient *oclient,
{
struct msg_lsa_change_notify *cn;
struct lsa_header *lsa;
+ void *p;
uint16_t lsalen;
cn = (struct msg_lsa_change_notify *)STREAM_DATA(msg->s);
@@ -610,9 +614,11 @@ static void ospf_apiclient_handle_lsa_delete(struct ospf_apiclient *oclient,
__func__, lsalen, OSPF_MAX_LSA_SIZE);
return;
}
- lsa = XMALLOC(MTYPE_OSPF_APICLIENT, lsalen);
- memcpy(lsa, &(cn->data), lsalen);
+ p = XMALLOC(MTYPE_OSPF_APICLIENT, lsalen);
+
+ memcpy(p, &(cn->data), lsalen);
+ lsa = p;
/* Invoke registered update callback function */
if (oclient->delete_notify) {
@@ -621,7 +627,7 @@ static void ospf_apiclient_handle_lsa_delete(struct ospf_apiclient *oclient,
}
/* free memory allocated by ospf apiclient library */
- XFREE(MTYPE_OSPF_APICLIENT, lsa);
+ XFREE(MTYPE_OSPF_APICLIENT, p);
}
static void ospf_apiclient_msghandle(struct ospf_apiclient *oclient,