summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/iicbus/iic.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index 673d635..54668c4 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -348,8 +348,10 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_TEMP, M_WAITOK);
usrbufs = malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITOK);
error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
- if (error)
+ if (error) {
+ free(usrbufs, M_TEMP);
break;
+ }
/* Alloc kernel buffers for userland data, copyin write data */
for (i = 0; i < d->nmsgs; i++) {
m = &((struct iic_msg *)buf)[i];
OpenPOWER on IntegriCloud