Fix two memleaks in r_json and r_x509

This commit is contained in:
pancake 2017-05-11 12:29:42 +02:00
parent 9523beb3bf
commit aa8a5fdb30
2 changed files with 5 additions and 1 deletions

View File

@ -136,6 +136,7 @@ R_API void r_json_object_add (RJSVar* object, const char* name, RJSVar* value) {
}
c = (char**) realloc (object->object.n, len * sizeof (char*));
if (!c) {
free (v);
return;
}
v[len - 1] = value;

View File

@ -820,7 +820,10 @@ RJSVar *r_x509_extensions_json (RX509Extensions* exts) {
for (i = 0; i < exts->length; ++i) {
RX509Extension *e = exts->extensions[i];
RJSVar* obj = r_json_object_new ();
if (!e || !obj) continue;
if (!e || !obj) {
r_json_var_free (obj);
continue;
}
if (e->extnID) {
r_json_object_add (obj, "OID", r_json_string_new (e->extnID->string));
}