diff --git a/libr/bin/bin.c b/libr/bin/bin.c index 7c9400790d..7a2c9ebaa6 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -139,12 +139,6 @@ static int r_bin_init_items(RBin *bin, int dummy) { return R_TRUE; } -R_API void r_bin_class_free (RBinClass *c) { - free (c->name); - free (c->super); - free (c); -} - #define RBINLISTFREE(x) if(x){r_list_free(x);x=NULL;} static void r_bin_free_items(RBin *bin) { int i; diff --git a/libr/bin/p/bin_dex.c b/libr/bin/p/bin_dex.c index eaaa16d453..552be9b985 100644 --- a/libr/bin/p/bin_dex.c +++ b/libr/bin/p/bin_dex.c @@ -145,6 +145,10 @@ static RList* methods (RBinArch *arch) { return ret; } +static void __r_bin_class_free(RBinClass *p) { + r_bin_class_free (p); +} + static RList* classes (RBinArch *arch) { RBinClass *class; RList *ret = NULL; @@ -154,7 +158,7 @@ static RList* classes (RBinArch *arch) { if (!(ret = r_list_new ())) return NULL; - ret->free = (RListFree)r_bin_class_free; + ret->free = (RListFree)__r_bin_class_free; for (i = 0; i < bin->header.class_size; i++) { r_buf_read_at (bin->b, (ut64) bin->header.class_offset + (sizeof (struct dex_class_t)*i), (ut8*)&entry, diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index 16c19b5770..98e1dafed6 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -237,9 +237,11 @@ typedef struct r_bin_bind_t { } RBinBind; #ifdef R_API + +#define r_bin_class_free(x) { free(x->name);free(x->super);free (x); } + R_API void r_bin_bind(RBin *b, RBinBind *bnd); /* bin.c */ -R_API void r_bin_class_free (RBinClass *c); R_API int r_bin_add(RBin *bin, RBinPlugin *foo); R_API int r_bin_xtr_add(RBin *bin, RBinXtrPlugin *foo); R_API void* r_bin_free(RBin *bin);