mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 11:53:13 +02:00
Fix memory leak on JSON-RPC log.send and fix a small auth url parse thing.
Actually that auth url method is not documented, we should probably remove it.
This commit is contained in:
@@ -221,8 +221,6 @@ void rpc_log_send(Client *client, json_t *request, json_t *params)
|
||||
REQUIRE_PARAM_STRING("event_id", event_id);
|
||||
OPTIONAL_PARAM_STRING("timestamp", timestamp);
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
|
||||
serialized = json_dumps(params, JSON_COMPACT);
|
||||
if (!serialized)
|
||||
{
|
||||
@@ -230,12 +228,16 @@ void rpc_log_send(Client *client, json_t *request, json_t *params)
|
||||
"Received malformed JSON in RPC log message (log.send) from $client.name");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
|
||||
MessageTag *json_mtag = safe_alloc(sizeof(MessageTag));
|
||||
safe_strdup(json_mtag->name, "unrealircd.org/json-log");
|
||||
safe_strdup(json_mtag->value, serialized);
|
||||
AddListItem(json_mtag, mtags);
|
||||
|
||||
safe_free(serialized);
|
||||
|
||||
const char *cmd_params[6] = {
|
||||
me.name,
|
||||
level,
|
||||
@@ -247,7 +249,7 @@ void rpc_log_send(Client *client, json_t *request, json_t *params)
|
||||
|
||||
do_cmd(&me, mtags, "SLOG", 5, cmd_params);
|
||||
safe_free_message_tags(mtags);
|
||||
|
||||
|
||||
/* Simply return success */
|
||||
result = json_boolean(1);
|
||||
rpc_response(client, request, result);
|
||||
|
||||
@@ -1430,7 +1430,7 @@ int rpc_parse_auth_uri(Client *client, WebRequest *web, char **username, char **
|
||||
{
|
||||
p += 9;
|
||||
*password = p;
|
||||
p = strchr(str, '&');
|
||||
p = strchr(p, '&');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user