From d81937481ddcbccb501626fd26306b3c6a476922 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Wed, 14 Oct 2020 12:30:01 -0400 Subject: ospfd: fix SA warnings in ospfd, ospfclient Fix some SA warnings in ospf GR and ospfclient code. Signed-off-by: Mark Stapp --- ospfclient/ospf_apiclient.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ospfclient') diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c index fb8ad3e60..d4f0dc953 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, -- cgit v1.2.3