gustavonihei commented on a change in pull request #695:
URL:
https://github.com/apache/incubator-nuttx-apps/pull/695#discussion_r628553570
##########
File path: netutils/webclient/webclient.c
##########
@@ -1044,6 +1227,38 @@ int webclient_perform(FAR struct webclient_context *ctx)
* Public Functions
****************************************************************************/
+/****************************************************************************
+ * Name: webclient_abort
+ *
+ * Description:
+ * This function is used to free the resources used by webclient_perform()
+ * in case of non blocking I/O.
+ *
+ * After webclient_perform() returned -EAGAIN, the application can either
+ * retry the operation by calling webclient_perform() again or abort
+ * the operation by calling this function.
+ *
+ ****************************************************************************/
+
+void webclient_abort(FAR struct webclient_context *ctx)
+{
+ struct wget_s *ws = ctx->ws;
+
+ if (ws == NULL)
+ {
+ return;
+ }
+
+ if (ws->need_conn_close)
+ {
+ struct conn *conn = &ws->conn;
+
+ conn_close(ctx, conn);
+ }
+
+ free(ws);
Review comment:
```suggestion
free(ws);
ctx->ws = NULL;
```
To avoid use-after-free errors, the freed pointer should be nullified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]