mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 18:08:28 -07:00
free
This commit is contained in:
parent
8c96d7bd3c
commit
215e1beee2
3
http.c
3
http.c
@ -537,6 +537,8 @@ char *j_encrypt(struct udata *ud, JsonNode *json, char *userdevice)
|
||||
memcpy(encrypted + crypto_secretbox_NONCEBYTES, ciphertext, ciphertext_len);
|
||||
b64 = base64_encode(encrypted, ciphertext_len + crypto_secretbox_NONCEBYTES);
|
||||
free(js_string);
|
||||
free(ciphertext);
|
||||
free(encrypted);
|
||||
|
||||
return (b64);
|
||||
|
||||
@ -602,6 +604,7 @@ static int dopublish(struct mg_connection *conn, const char *uri)
|
||||
|
||||
json_append_member(json, "_type", json_mkstring("encrypted"));
|
||||
json_append_member(json, "data", json_mkstring(enc));
|
||||
free(enc);
|
||||
|
||||
return json_response(conn, json);
|
||||
}
|
||||
|
@ -542,9 +542,9 @@ unsigned char *decrypt(struct udata *ud, char *topic, char *p64, char *username,
|
||||
unsigned char *ciphertext, *cleartext;
|
||||
size_t ciphertext_len;
|
||||
int n, klen;
|
||||
UT_string *userdev;
|
||||
static UT_string *userdev = NULL;
|
||||
|
||||
utstring_new(userdev);
|
||||
utstring_renew(userdev);
|
||||
utstring_printf(userdev, "%s-%s", username, device);
|
||||
|
||||
memset(key, 0, sizeof(key));
|
||||
@ -857,10 +857,13 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
|
||||
handle_message(ud, topic, cleartext, strlen(cleartext), retain);
|
||||
free(cleartext);
|
||||
}
|
||||
if (_typestr) free(_typestr);
|
||||
json_delete(json);
|
||||
return;
|
||||
}
|
||||
}
|
||||
olog(LOG_ERR, "no `data' in encrypted %s", topic);
|
||||
json_delete(json);
|
||||
return;
|
||||
break;
|
||||
#endif /* WITH_ENCRYPT */
|
||||
|
Loading…
Reference in New Issue
Block a user