Fix pdJ for quotes in flag names

This commit is contained in:
Florian Märkl 2019-01-20 13:28:50 +01:00
parent 6c2d945272
commit d5a27c45c7

View File

@ -1608,6 +1608,7 @@ static void ds_show_functions(RDisasmState *ds) {
RAnalFunction *f;
RCore *core = ds->core;
char *fcn_name;
bool fcn_name_alloc = false; // whether fcn_name needs to be freed by this function
char *sign;
if (!ds->show_functions) {
@ -1622,12 +1623,24 @@ static void ds_show_functions(RDisasmState *ds) {
}
if (demangle) {
fcn_name = r_bin_demangle (core->bin->cur, lang, f->name, f->addr);
if (!fcn_name) {
fcn_name = strdup (f->name);
if (fcn_name) {
fcn_name_alloc = true;
} else {
fcn_name = f->name;
}
} else {
fcn_name = f->name;
}
if (ds->use_json) {
char *fcn_name_raw = fcn_name;
fcn_name = r_str_escape_utf8_for_json (fcn_name_raw, -1);
if (fcn_name_alloc) {
free (fcn_name_raw);
}
fcn_name_alloc = true;
}
ds_begin_line (ds);
sign = r_anal_fcn_to_string (core->anal, f);
if (f->type == R_ANAL_FCN_TYPE_LOC) {
@ -1762,7 +1775,7 @@ static void ds_show_functions(RDisasmState *ds) {
}
}
r_anal_fcn_vars_cache_fini (&vars_cache);
if (demangle) {
if (fcn_name_alloc) {
free (fcn_name);
}
}