Skip to contentSkip to conversation

samples cn_test: fix cn leakage

PATCH New [email protected] 1 participant 1 message Jun 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples cn_test: fix cn leakage

From: liboling <[email protected]>

Error return when add the second cn_test_id,
we need del the first cn_test_id.

---
 samples/connector/cn_test.c | 1 +
 1 file changed, 1 insertion(+)
samples/connector/cn_test.c +1 -0
index 0958a171d0..275e3f9082 100644
@@ -151,6 +151,7 @@ static int cn_test_init(void)
 	cn_test_id.val++;
 	err = cn_add_callback(&cn_test_id, cn_test_name, cn_test_callback);
 	if (err) {
+		cn_test_id.val--;
 		cn_del_callback(&cn_test_id);
 		goto err_out;
 	}
Signature · 1 line
2.17.1