Print this page
6070 libdisasm: attach/detach arch ops should be optional
Reviewed by: Robert Mustacchi <rm@joyent.com>
*** 141,151 ****
--- 141,153 ----
}
void
dis_handle_destroy(dis_handle_t *dhp)
{
+ if (dhp->dh_arch->da_handle_detach != NULL)
dhp->dh_arch->da_handle_detach(dhp);
+
dis_free(dhp, sizeof (dis_handle_t));
}
dis_handle_t *
dis_handle_create(int flags, void *data, dis_lookup_f lookup_func,
*** 179,189 ****
/*
* Allow the architecture-specific code to allocate
* its private data.
*/
! if (arch->da_handle_attach(dhp) != 0) {
dis_free(dhp, sizeof (dis_handle_t));
/* dis errno already set */
return (NULL);
}
--- 181,192 ----
/*
* Allow the architecture-specific code to allocate
* its private data.
*/
! if (arch->da_handle_attach != NULL &&
! arch->da_handle_attach(dhp) != 0) {
dis_free(dhp, sizeof (dis_handle_t));
/* dis errno already set */
return (NULL);
}