summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <jeffpc@josefsipek.net>2015-10-16 01:23:30 -0400
committerDan McDonald <danmcd@omniti.com>2015-11-09 16:56:28 -0500
commit0c923cf7b6cda6dcbc5df1a5974bed6386c49807 (patch)
treea696245e3bad3986bcd6ea900f29e997e19a4a2e /usr/src
parentcfc41e72a4f85ff48430f435531264fca458f55d (diff)
downloadillumos-gate-0c923cf7b6cda6dcbc5df1a5974bed6386c49807.tar.gz
6070 libdisasm: attach/detach arch ops should be optional
Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libdisasm/common/libdisasm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr/src/lib/libdisasm/common/libdisasm.c b/usr/src/lib/libdisasm/common/libdisasm.c
index 057d4facb1..a7340ae009 100644
--- a/usr/src/lib/libdisasm/common/libdisasm.c
+++ b/usr/src/lib/libdisasm/common/libdisasm.c
@@ -143,7 +143,9 @@ dis_flags_clear(dis_handle_t *dhp, int f)
void
dis_handle_destroy(dis_handle_t *dhp)
{
- dhp->dh_arch->da_handle_detach(dhp);
+ if (dhp->dh_arch->da_handle_detach != NULL)
+ dhp->dh_arch->da_handle_detach(dhp);
+
dis_free(dhp, sizeof (dis_handle_t));
}
@@ -181,7 +183,8 @@ dis_handle_create(int flags, void *data, dis_lookup_f lookup_func,
* Allow the architecture-specific code to allocate
* its private data.
*/
- if (arch->da_handle_attach(dhp) != 0) {
+ 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);