You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/07/26 11:58:50 UTC

[GitHub] michal-narajowski closed pull request #149: mesh: Fix a possible memory leak

michal-narajowski closed pull request #149: mesh: Fix a possible memory leak
URL: https://github.com/apache/mynewt-nimble/pull/149
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/host/mesh/src/access.c b/nimble/host/mesh/src/access.c
index b06234a4..12e3bdec 100644
--- a/nimble/host/mesh/src/access.c
+++ b/nimble/host/mesh/src/access.c
@@ -676,21 +676,25 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
 	BT_DBG("");
 
 	if (!pub) {
-		return -ENOTSUP;
+		err = -ENOTSUP;
+		goto done;
 	}
 
 	if (pub->addr == BT_MESH_ADDR_UNASSIGNED) {
-		return -EADDRNOTAVAIL;
+		err = -EADDRNOTAVAIL;
+		goto done;
 	}
 
 	key = bt_mesh_app_key_find(pub->key);
 	if (!key) {
-		return -EADDRNOTAVAIL;
+		err = -EADDRNOTAVAIL;
+		goto done;
 	}
 
 	if (pub->msg->om_len + 4 > BT_MESH_TX_SDU_MAX) {
 		BT_ERR("Message does not fit maximum SDU size");
-		return -EMSGSIZE;
+		err = -EMSGSIZE;
+		goto done;
 	}
 
 	if (pub->count) {
@@ -719,6 +723,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
 		pub->count = 0;
 	}
 
+done:
 	os_mbuf_free_chain(sdu);
 	return err;
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services