dtls.c: fix memory leak in dtls_free_context()
In [1], Anton Meier points out that the nodes in the sendqueue are
not freed when the context is destroyed. This change adds the
suggested fix.
[1] https://dev.eclipse.org/mhonarc/lists/tinydtls-dev/msg00139.html
Change-Id: Ia248b0fbe4c5adb56ee883ac05001eefc67c0d8c
diff --git a/dtls.c b/dtls.c
index fc7016a..e11a57b 100644
--- a/dtls.c
+++ b/dtls.c
@@ -3986,6 +3986,9 @@
}
}
+ if (ctx->sendqueue != NULL) {
+ netq_delete_all(&ctx->sendqueue);
+ }
free_context(ctx);
}