printf("%s<%04x>: %08x\n", levels[level], regbase, dword);
}
- if (info) {
- free(info->name);
- free(info);
- }
+ rnn_reginfo_free(info);
}
static void
printf("\t\t\t");
dump_register(rnn_pipe, reg, data);
}
+ rnn_reginfo_free(info);
} else {
printf("\t\twrite %s (%05x) context %d\n", regname(reg, 1), reg, context);
dump_register_val(reg, data, 2);
} else {
printf("<%04x>: %08x\n", offset, value);
}
+ rnn_reginfo_free(info);
}
static void
printlvl(level, "pkt4(cs, %u, (%u), %u);\n", regbase, cnt, dword);
}
+ rnn_reginfo_free(info);
+
return 1;
}
return NULL;
}
+/* call rnn_reginfo_free() to free the result */
struct rnndecaddrinfo *
rnn_reginfo(struct rnn *rnn, uint32_t regbase)
{
return rnndec_decodeaddr(rnn->vc, finddom(rnn, regbase), regbase, 0);
}
+void
+rnn_reginfo_free(struct rnndecaddrinfo *info)
+{
+ if (!info)
+ return;
+ free(info->name);
+ free(info);
+}
+
const char *
rnn_enumname(struct rnn *rnn, const char *name, uint32_t val)
{
uint32_t rnn_regbase(struct rnn *rnn, const char *name);
const char *rnn_regname(struct rnn *rnn, uint32_t regbase, int color);
struct rnndecaddrinfo *rnn_reginfo(struct rnn *rnn, uint32_t regbase);
+void rnn_reginfo_free(struct rnndecaddrinfo *info);
const char *rnn_enumname(struct rnn *rnn, const char *name, uint32_t val);
struct rnndelem *rnn_regelem(struct rnn *rnn, const char *name);
}
lua_pushstring(L, decoded);
free(decoded);
- if (info) {
- free(info->name);
- free(info);
- }
+ rnn_reginfo_free(info);
return 1;
}
}
lua_pushstring(L, decoded);
free(decoded);
- if (info) {
- free(info->name);
- free(info);
- }
+ rnn_reginfo_free(info);
return 1;
}