slurmrestd - Add http_context_free_null_auth()
Add http_context_free_null_auth() to avoid duplicated code clearing
context->auth using http_context_set_auth().
Issue: 50189
diff --git a/src/slurmrestd/http.c b/src/slurmrestd/http.c
index 1086702..383c955 100644
--- a/src/slurmrestd/http.c
+++ b/src/slurmrestd/http.c
@@ -834,3 +834,13 @@
return old;
}
+
+extern void http_context_free_null_auth(http_context_t *context)
+{
+ if (!context)
+ return;
+
+ xassert(context->magic == MAGIC);
+
+ FREE_NULL_REST_AUTH(context->auth);
+}
diff --git a/src/slurmrestd/http.h b/src/slurmrestd/http.h
index 0b2bb21..ec2aee7 100644
--- a/src/slurmrestd/http.h
+++ b/src/slurmrestd/http.h
@@ -144,4 +144,10 @@
*/
extern void *http_context_set_auth(http_context_t *context, void *auth);
+/*
+ * Release and NULL auth pointer from context
+ * IN context - connection context
+ */
+extern void http_context_free_null_auth(http_context_t *context);
+
#endif /* SLURMRESTD_HTTP_H */