Skip to content

Commit

Permalink
Check codemeta APIs nullability for radareorg#23490
Browse files Browse the repository at this point in the history
  • Loading branch information
astralia committed Nov 7, 2024
1 parent 0823c76 commit 9a4243c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libr/anal/codemeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ R_API RCodeMetaItem *r_codemeta_item_clone(RCodeMetaItem *code) {
}

R_API RCodeMeta *r_codemeta_clone(RCodeMeta *code) {
R_RETURN_VAL_IF_FAIL (code, NULL);
RCodeMeta *r = r_codemeta_new (code->code);
if (r) {
RCodeMetaItem *mi;
Expand All @@ -41,10 +42,11 @@ R_API RCodeMeta *r_codemeta_clone(RCodeMeta *code) {
}

R_API RCodeMeta *r_codemeta_new(const char *code) {
R_RETURN_VAL_IF_FAIL (code, NULL);
RCodeMeta *r = R_NEW0 (RCodeMeta);
if (r) {
r->tree = r_crbtree_new (NULL);
r->code = code? strdup (code): NULL;
r->code = strdup (code);
r_vector_init (&r->annotations, sizeof (RCodeMetaItem),
(RVectorFree)r_codemeta_item_fini, NULL);
}
Expand Down Expand Up @@ -162,6 +164,7 @@ R_API void r_codemeta_add_item(RCodeMeta *code, RCodeMetaItem *mi) {
}

R_API RPVector *r_codemeta_at(RCodeMeta *code, size_t offset) {
R_RETURN_VAL_IF_FAIL (code, NULL);
return r_codemeta_in (code, offset, offset + 1);
}

Expand Down

0 comments on commit 9a4243c

Please sign in to comment.