diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 088f431..6b2cfaa 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -1150,8 +1150,8 @@ void slbt_free_driver_ctx(struct slbt_driver_ctx * ctx)
 	uintptr_t			addr;
 
 	if (ctx) {
-		addr = (uintptr_t)ctx - offsetof(struct slbt_driver_ctx_alloc,ctx);
-		addr = addr - offsetof(struct slbt_driver_ctx_impl,ctx);
+		addr = (uintptr_t)ctx - offsetof(struct slbt_driver_ctx_impl,ctx);
+		addr = addr - offsetof(struct slbt_driver_ctx_alloc,ctx);
 		ictx = (struct slbt_driver_ctx_alloc *)addr;
 		slbt_free_driver_ctx_impl(ictx);
 	}