本文整理汇总了C++中R_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ R_FREE函数的具体用法?C++ R_FREE怎么用?C++ R_FREE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reil_if
static int reil_if(RAnalEsil *esil) {
RAnalReilInst *ins;
RAnalReilArg *op2, *op1;
op2 = reil_pop_arg (esil);
if (!op2) return false;
op1 = reil_pop_arg (esil);
if (!op1) {
R_FREE (op2);
return false;
}
ins = R_NEW0 (RAnalReilInst);
if (!ins) {
R_FREE (op2);
R_FREE (op1);
return false;
}
ins->opcode = REIL_JCC;
ins->arg[0] = op1;
ins->arg[2] = op2;
ins->arg[1] = R_NEW0 (RAnalReilArg);
if (!ins->arg[1]) {
reil_free_inst (ins);
return false;
}
reil_make_arg (esil, ins->arg[1], " ");
reil_print_inst (esil, ins);
reil_free_inst (ins);
return true;
}
示例2: reil_peekn
// n = 8, 4, 2, 1
static int reil_peekn(RAnalEsil *esil, ut8 n) {
RAnalReilArg *op2;
RAnalReilArg *op1 = reil_pop_arg (esil);
if (!op1) return false;
reil_push_arg (esil, op1);
reil_peek (esil);
// No need to cast if n = 0
if (n == 0) {
R_FREE (op1);
return true;
}
R_FREE (op1);
op1 = reil_pop_arg (esil);
if (!op1) return false;
op2 = R_NEW0 (RAnalReilArg);
if (!op2) {
R_FREE (op1);
return false;
}
op2->size = n * 8;
op2->type = ARG_TEMP;
get_next_temp_reg (esil, op2->name);
reil_cast_size (esil, op1, op2);
esil->Reil->lastsz = 8 * n;
R_FREE (op2);
return true;
}
示例3: strlen
// TODO: Add in a Coverity modelling file
char *strcat_dup(char *s1, char *s2, st32 n_free) {
char *res;
ut32 len_s1 = s1? strlen (s1) : 0;
ut32 len_s2 = s2? strlen (s2) : 0;
if (!(res = (char *)malloc (len_s1 + len_s2 + 1))) {
return NULL;
}
if (len_s1 > 0) {
memcpy (res, s1, len_s1);
}
if (len_s2 > 0) {
memcpy (res + len_s1, s2, len_s2);
}
res[len_s1 + len_s2] = '\0';
if (n_free == 1) {
R_FREE (s1);
} else if (n_free == 2) {
R_FREE (s2);
} else if (n_free == 3) {
R_FREE (s1);
R_FREE (s2);
}
return res;
}
示例4: r_anal_op_fini
R_API bool r_anal_op_fini(RAnalOp *op) {
if (!op) {
return false;
}
if (((ut64)(size_t)op) == UT64_MAX) {
return false;
}
if (((ut64)(size_t)op->mnemonic) == UT64_MAX) {
return false;
}
r_anal_var_free (op->var);
r_anal_value_free (op->src[0]);
r_anal_value_free (op->src[1]);
r_anal_value_free (op->src[2]);
r_anal_value_free (op->dst);
r_strbuf_fini (&op->esil);
r_anal_switch_op_free (op->switch_op);
op->src[0] = NULL;
op->src[1] = NULL;
op->src[2] = NULL;
op->dst = NULL;
op->var = NULL;
op->switch_op = NULL;
R_FREE (op->mnemonic);
R_FREE (op->reg);
return true;
}
示例5: r_bin_bflt_free
void r_bin_bflt_free(struct r_bin_bflt_obj *obj) {
if (obj) {
R_FREE (obj->hdr);
R_FREE (obj->b);
R_FREE (obj);
}
}
示例6: reil_free_inst
// Free ins and all its arguments
void reil_free_inst(RAnalReilInst *ins) {
if (!ins) return;
if (ins->arg[0]) R_FREE(ins->arg[0]);
if (ins->arg[1]) R_FREE(ins->arg[1]);
if (ins->arg[2]) R_FREE(ins->arg[2]);
R_FREE(ins);
}
示例7: rcc_element
static void rcc_element(REgg *egg, char *str) {
REggEmit *e = egg->remit;
char *p = strrchr (str, ',');
int num, num2;
if (CTX) {
nargs = 0;
if (mode == GOTO)
mode = NORMAL; // XXX
while (p) {
*p = '\0';
p = (char *)skipspaces (p+1);
rcc_pusharg (egg, p);
p = strrchr (str, ',');
}
if (callname)
rcc_pusharg (egg, str);
else
if (mode == NORMAL) {
if (!atoi (str)) {
if (dstvar == NULL) /* return string */
dstvar = strdup (".fix0");
rcc_pushstr (egg, str, 1);
}
}
} else {
switch (mode) {
case ALIAS:
e->equ (egg, dstvar, str);
R_FREE (dstvar);
mode = NORMAL;
break;
case SYSCALL:
syscalls[nsyscalls].name = strdup (dstvar);
syscalls[nsyscalls].arg = strdup (str);
nsyscalls++;
R_FREE (dstvar);
break;
case GOTO:
elem[elem_n] = 0;
e->jmp (egg, elem, 0);
break;
default:
p = strchr (str, ',');
if (p) {
*p='\0';
num2 = atoi (p+1);
} else num2 = 0;
num = atoi (str) + num2;
stackframe = num;
stackfixed = num2;
if (mode != NAKED)
e->frame (egg, stackframe+stackfixed);
}
elem[0] = 0;
elem_n = 0;
}
}
示例8: get_template
int get_template(char *buf, SStrInfo *str_info)
{
int len = 0;
unsigned int i = 0;
char *str_type_code = 0;
char *tmp = strstr(buf, "@");
STypeCodeStr type_code_str;
RListIter *it = 0;
RList *saved_abbr_names = abbr_names; // save current abbr names, this
if (!tmp) {
goto get_template_err;
}
if (!init_type_code_str_struct(&type_code_str)) {
goto get_template_err;
}
abbr_names = r_list_new ();
// get/copy template len/name
len += (tmp - buf + 1);
copy_string(&type_code_str, buf, len - 1);
buf += len;
if (*buf != '@') {
copy_string(&type_code_str, "<", 0);
}
// get identifier
while (*buf != '@') {
if (i) {
copy_string (&type_code_str, ", ", 0);
}
if (get_type_code_string (buf, &i, &str_type_code) != eDemanglerErrOK) {
len = 0;
goto get_template_err;
}
copy_string (&type_code_str, str_type_code, 0);
buf += i;
len += i;
R_FREE (str_type_code);
}
if (*buf != '@') {
len = 0;
goto get_template_err;
}
copy_string (&type_code_str, ">", 0);
buf++;
len++;
str_info->str_ptr = type_code_str.type_str;
str_info->len = type_code_str.curr_pos;
get_template_err:
#if 0
it = r_list_iterator (abbr_names);
r_list_foreach (abbr_names, it, tmp) {
R_FREE (tmp);
}
示例9: parsedatachar
static int parsedatachar(REgg *egg, char c) {
static int inlinectr = 0;
char *str;
int i, j;
if (!dstval) {
return 0;
}
/* skip until '{' */
if (c == '{') { /* XXX: repeated code!! */
rcc_context (egg, 1);
if (++inlinectr==1)
return (ndstval = 0);
} else if (inlinectr == 0) {
/* capture value between parenthesis [email protected](NNN) { ... } */
if (c==')') {
stackframe = atoi (dstval);
ndstval = 0;
} else {
dstval[ndstval++] = c;
}
return 0;
}
/* capture body */
if (c == '}') { /* XXX: repeated code!! */
if (CTX< 2) {
inlinectr = 0;
rcc_context (egg, -1);
slurp = 0;
mode = NORMAL;
/* register */
if (dstval != NULL && dstvar != NULL) {
dstval[ndstval]='\0';
egg->remit->comment (egg, "data (%s)(%s)size=(%d)\n",
dstvar, dstval, stackframe);
r_egg_printf (egg, ".data\n");
for (str=dstval; is_space (*str); str++);
j = (stackframe)? stackframe: 1;
/* emit label */
r_egg_printf (egg, "%s:\n", dstvar);
for (i=1; i<=j; i++) {
if (*str=='"')
r_egg_printf (egg, ".ascii %s%s\n", dstval, (i==j)?"\"\\x00\"":"");
else r_egg_printf (egg, ".long %s\n", dstval);
}
r_egg_printf (egg, ".text\n");
R_FREE (dstvar);
R_FREE (dstval);
ndstval = 0;
CTX = 0;
return 1;
}
}
}
dstval[ndstval++] = c;
return 0;
}
示例10: __close
static int __close(RIODesc *fd) {
RIOSparse *riom;
if (!fd || !fd->data) {
return -1;
}
riom = fd->data;
R_FREE (riom->buf);
R_FREE (fd->data);
return 0;
}
示例11: __close
static int __close(RIODesc *fd) {
RIOBfdbg *riom;
if (!fd || !fd->data) {
return -1;
}
riom = fd->data;
bfvm_free (riom->bfvm);
R_FREE (riom->buf);
R_FREE (fd->data);
return 0;
}
示例12: init_pdb_parser
int init_pdb_parser(R_PDB *pdb, const char *filename) {
char *signature = NULL;
int bytes_read = 0;
if (!pdb) {
eprintf ("struct R_PDB is not correct\n");
goto error;
}
if (!pdb->cb_printf)
pdb->cb_printf = (PrintfCallback)printf;
pdb->buf = r_buf_file(filename);
// pdb->fp = r_sandbox_fopen (filename, "rb");
// if (!pdb->fp) {
// eprintf ("file %s can not be open\n", filename);
// goto error;
// }
signature = (char *)calloc (1, PDB7_SIGNATURE_LEN);
if (!signature) {
eprintf ("memory allocation error\n");
goto error;
}
bytes_read = r_buf_read(pdb->buf, (unsigned char *)signature, PDB7_SIGNATURE_LEN);
if (bytes_read != PDB7_SIGNATURE_LEN) {
eprintf ("file reading error\n");
goto error;
}
r_buf_seek(pdb->buf, 0, 0);
if (!memcmp (signature, PDB7_SIGNATURE, PDB7_SIGNATURE_LEN)) {
pdb->pdb_parse = pdb7_parse;
} else {
goto error;
}
R_FREE (signature);
pdb->pdb_streams = r_list_new ();
pdb->stream_map = 0;
pdb->finish_pdb_parse = finish_pdb_parse;
pdb->print_types = print_types;
pdb->print_gvars = print_gvars;
// printf("init_pdb_parser() finish with success\n");
return 1;
error:
R_FREE (signature);
return 0;
}
示例13: r_strht_free
R_API RPrint *r_print_free(RPrint *p) {
if (!p) return NULL;
r_strht_free (p->formats);
p->formats = NULL;
if (p->zoom) {
free (p->zoom->buf);
free (p->zoom);
p->zoom = NULL;
}
R_FREE (p->lines_cache);
R_FREE (p->row_offsets);
free (p);
return NULL;
}
示例14: r_cons_pal_free
R_API void r_cons_pal_free () {
int i;
RCons *cons = r_cons_singleton ();
for (i = 0; i < R_CONS_PALETTE_LIST_SIZE; i++) {
if (cons->pal.list[i]) R_FREE (cons->pal.list[i]);
}
}
示例15: r_cons_pal_random
R_API void r_cons_pal_random () {
RCons *cons = r_cons_singleton ();
ut8 r, g, b;
char val[32];
const char *k;
int i;
for (i = 0; ; i++) {
k = r_cons_pal_get_i (i);
if (!k) break;
if (cons->truecolor > 0) {
r = r_num_rand (0xff);
g = r_num_rand (0xff);
b = r_num_rand (0xff);
sprintf (val, "rgb:%02x%02x%02x", r, g, b);
r_cons_pal_set (k, val);
} else {
char *s = r_cons_color_random_string (0);
if (s) {
r_cons_pal_set (k, s);
free (s);
} else {
r_cons_pal_set (k, "red");
}
}
}
for (i = 0; i < R_CONS_PALETTE_LIST_SIZE; i++) {
if (cons->pal.list[i]) R_FREE (cons->pal.list[i]);
cons->pal.list[i] = r_cons_color_random (0);
}
}