mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 09:06:02 +00:00
Fix two minor leaks spotted by coverity
This commit is contained in:
parent
3e656374ed
commit
7f472c50eb
@ -985,6 +985,7 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
||||
}
|
||||
Sdb *sdb = sdb_new0 ();
|
||||
if (!sdb) {
|
||||
free (defs);
|
||||
return false;
|
||||
}
|
||||
size_t shsize = shdr->sh_size;
|
||||
|
@ -4719,24 +4719,23 @@ static void print_json_string(RCore *core, const char* block, int len, const cha
|
||||
slen = strlen (tblock);
|
||||
}
|
||||
PJ *pj = r_core_pj_new (core);
|
||||
if (!pj) {
|
||||
return;
|
||||
if (pj) {
|
||||
pj_o (pj);
|
||||
pj_k (pj, "string");
|
||||
// TODO: add pj_kd for data to pass key(string) and value(data,len) instead of pj_ks which null terminates
|
||||
char *str = r_str_utf16_encode (tblock, slen); // XXX just block + len should be fine, pj takes care of this
|
||||
pj_raw (pj, "\"");
|
||||
pj_raw (pj, str);
|
||||
free (str);
|
||||
pj_raw (pj, "\"");
|
||||
pj_kn (pj, "offset", core->offset);
|
||||
pj_ks (pj, "section", section_name);
|
||||
pj_ki (pj, "length", slen);
|
||||
pj_ks (pj, "type", type);
|
||||
pj_end (pj);
|
||||
r_cons_println (pj_string (pj));
|
||||
pj_free (pj);
|
||||
}
|
||||
pj_o (pj);
|
||||
pj_k (pj, "string");
|
||||
// TODO: add pj_kd for data to pass key(string) and value(data,len) instead of pj_ks which null terminates
|
||||
char *str = r_str_utf16_encode (tblock, slen); // XXX just block + len should be fine, pj takes care of this
|
||||
pj_raw (pj, "\"");
|
||||
pj_raw (pj, str);
|
||||
free (str);
|
||||
pj_raw (pj, "\"");
|
||||
pj_kn (pj, "offset", core->offset);
|
||||
pj_ks (pj, "section", section_name);
|
||||
pj_ki (pj, "length", slen);
|
||||
pj_ks (pj, "type", type);
|
||||
pj_end (pj);
|
||||
r_cons_println (pj_string (pj));
|
||||
pj_free (pj);
|
||||
if (tblock != block) {
|
||||
free (tblock);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user