diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-10-14 19:18:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-14 19:18:24 -0400 |
| commit | 46ef2fb21f2bec030bc7735e595f0f97535bf9ae (patch) | |
| tree | b498fffeab5046d6c7fd590dec11d4c2aa2701b2 /ospfclient/ospf_apiclient.c | |
| parent | 974c396af3f21f76659f77177e218bd09dc401d3 (diff) | |
| parent | d81937481ddcbccb501626fd26306b3c6a476922 (diff) | |
Merge pull request #7308 from mjstapp/fix_ospf_gr_sa
ospfd: fix SA warnings in ospfd, ospfclient
Diffstat (limited to 'ospfclient/ospf_apiclient.c')
| -rw-r--r-- | ospfclient/ospf_apiclient.c | 18 |
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, |
