diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-10-14 12:30:01 -0400 | 
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2020-10-14 13:41:00 -0400 | 
| commit | d81937481ddcbccb501626fd26306b3c6a476922 (patch) | |
| tree | 224a3a4dc1ec6f4f5791a51d9cfb1e712efb3cc2 /ospfclient/ospf_apiclient.c | |
| parent | 6431621e4eb11c4b85d6c29f79d060d59b0ed5d2 (diff) | |
ospfd: fix SA warnings in ospfd, ospfclient
Fix some SA warnings in ospf GR and ospfclient code.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
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,  | 
