Fix some possible NULL-deref under memory-pressure

This commit is contained in:
jvoisin 2015-09-25 02:13:58 +02:00
parent 0576be2359
commit 3abab8526b
4 changed files with 5 additions and 9 deletions

View File

@ -93,7 +93,6 @@ R_API RList *r_anal_reflines_get(RAnal *anal, ut64 addr, const ut8 *buf, ut64 le
item->to = caseop->jump;
item->index = index++;
r_list_append (list, item);
//list_add_tail (&(list2->list), &(list->list));
count++;
}
}

View File

@ -51,6 +51,8 @@ RBinAddr *r_coff_get_entry(struct r_bin_coff_obj *obj) {
RBinAddr *addr = R_NEW0 (RBinAddr);
int i;
if (!addr) return -1;
/* Simplest case, the header provides the entrypoint address */
if (obj->hdr.f_opthdr) {
addr->paddr = obj->opt_hdr.entry;

View File

@ -4,6 +4,7 @@
R_API RStrpool* r_strpool_new (int sz) {
RStrpool *p = R_NEW (RStrpool);
if (!p) return NULL;
if (sz<1) sz = 1024;
p->size = sz;
p->len = 0;

View File

@ -51,21 +51,15 @@ static void update_depth (RTreeNode *n, RTreeVisitor *vis) {
static RTreeNode *node_new (RTree *t, void *data) {
RTreeNode *n = R_NEW0 (RTreeNode);
n->parent = NULL;
if (!n) return NULL;
n->children = r_list_new ();
n->children->free = NULL;
n->n_children = 0;
n->data = data;
n->free = NULL;
n->depth = 0;
n->tree = t;
return n;
}
R_API RTree *r_tree_new (void) {
RTree *t = R_NEW0 (RTree);
t->root = NULL;
return t;
return R_NEW0 (RTree);
}
R_API void r_tree_free (RTree* t) {