Date: Sat, 15 Oct 2011 15:57:56 +0000 (UTC) From: Christian Brueffer <brueffer@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r226398 - head/sys/dev/iicbus Message-ID: <201110151557.p9FFvuuc020536@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brueffer Date: Sat Oct 15 15:57:55 2011 New Revision: 226398 URL: http://svn.freebsd.org/changeset/base/226398 Log: Properly free resources in an error case. CID: 4203 Found with: Coverity Prevent(tm) MFC after: 1 week Modified: head/sys/dev/iicbus/iic.c Modified: head/sys/dev/iicbus/iic.c ============================================================================== --- head/sys/dev/iicbus/iic.c Sat Oct 15 15:21:33 2011 (r226397) +++ head/sys/dev/iicbus/iic.c Sat Oct 15 15:57:55 2011 (r226398) @@ -348,8 +348,10 @@ iicioctl(struct cdev *dev, u_long cmd, c 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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110151557.p9FFvuuc020536>