diff options
author | brueffer <brueffer@FreeBSD.org> | 2011-10-15 15:57:55 +0000 |
---|---|---|
committer | brueffer <brueffer@FreeBSD.org> | 2011-10-15 15:57:55 +0000 |
commit | f9ab6d932b230119bdf8030024b673f60830e6da (patch) | |
tree | 1b7c5ede5c9b344696380b6ea753b90a9a81e359 | |
parent | 2f1e586900d3dd1525085e659a5098430694a597 (diff) | |
download | FreeBSD-src-f9ab6d932b230119bdf8030024b673f60830e6da.zip FreeBSD-src-f9ab6d932b230119bdf8030024b673f60830e6da.tar.gz |
Properly free resources in an error case.
CID: 4203
Found with: Coverity Prevent(tm)
MFC after: 1 week
-rw-r--r-- | sys/dev/iicbus/iic.c | 4 |
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]; |