mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-23 14:28:07 +00:00
Fix RStrBuf memleak in afta (#11251)
This commit is contained in:
parent
05fd10fd53
commit
019491bcbc
@ -183,7 +183,7 @@ static void var_add_range (RAnal *a, RAnalVar *var, int cond, ut64 val) {
|
||||
sdb_array_append_num (ADB, key, val, 0);
|
||||
}
|
||||
|
||||
R_API char *var_get_constraint (RAnal *a, RAnalVar *var) {
|
||||
R_API RStrBuf *var_get_constraint (RAnal *a, RAnalVar *var) {
|
||||
const char *key = RKEY (var->addr, var->kind, var->delta);
|
||||
int i, n = sdb_array_length (ADB, key);
|
||||
bool low = false, high = false;
|
||||
@ -225,7 +225,7 @@ R_API char *var_get_constraint (RAnal *a, RAnalVar *var) {
|
||||
high = false;
|
||||
}
|
||||
}
|
||||
return r_strbuf_get (sb);
|
||||
return sb;
|
||||
}
|
||||
|
||||
static RList *parse_format(RCore *core, char *fmt) {
|
||||
|
@ -1407,15 +1407,18 @@ static ut32 tmp_get_realsize (RAnalFunction *f) {
|
||||
|
||||
static void ds_show_functions_argvar(RDisasmState *ds, RAnalVar *var, const char *base, bool is_var, char sign) {
|
||||
int delta = sign == '+' ? var->delta : -var->delta;
|
||||
const char *pfx = is_var ? "var" : "arg";
|
||||
char *constr = NULL;
|
||||
const char *pfx = is_var ? "var" : "arg", *constr = NULL;
|
||||
RStrBuf *constr_buf = NULL;
|
||||
bool cond = false;
|
||||
if (ds->core && ds->core->anal) {
|
||||
constr = var_get_constraint (ds->core->anal, var);
|
||||
}
|
||||
if (constr && *constr) {
|
||||
constr_buf = var_get_constraint (ds->core->anal, var);
|
||||
if (constr_buf) {
|
||||
constr = r_strbuf_get (constr_buf);
|
||||
if (constr[0]) {
|
||||
cond = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
r_cons_printf ("%s%s %s%s%s%s %s%s%s%s@ %s%c0x%x", COLOR_ARG (ds, color_func_var), pfx,
|
||||
COLOR_ARG (ds, color_func_var_type), var->type,
|
||||
r_str_endswith (var->type, "*") ? "" : " ",
|
||||
@ -1424,6 +1427,7 @@ static void ds_show_functions_argvar(RDisasmState *ds, RAnalVar *var, const char
|
||||
cond? constr: "",
|
||||
cond? "} ":"",
|
||||
base, sign, delta);
|
||||
r_strbuf_free (constr_buf);
|
||||
}
|
||||
|
||||
static void printVarSummary(RDisasmState *ds, RList *list) {
|
||||
|
@ -510,7 +510,7 @@ R_API RList* r_core_anal_cycles (RCore *core, int ccl);
|
||||
|
||||
/*tp.c*/
|
||||
R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn);
|
||||
R_API char *var_get_constraint (RAnal *a, RAnalVar *var);
|
||||
R_API RStrBuf *var_get_constraint (RAnal *a, RAnalVar *var);
|
||||
|
||||
/* asm.c */
|
||||
typedef struct r_core_asm_hit {
|
||||
|
Loading…
x
Reference in New Issue
Block a user