Date: Wed, 12 Dec 2018 11:36:03 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341893 - stable/11/sys/contrib/rdma/krping Message-ID: <201812121136.wBCBa3nU051770@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Dec 12 11:36:03 2018 New Revision: 341893 URL: https://svnweb.freebsd.org/changeset/base/341893 Log: MFC r341539: krping: Fix for memory leak in error case. Sponsored by: Mellanox Technologies Modified: stable/11/sys/contrib/rdma/krping/krping_dev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- stable/11/sys/contrib/rdma/krping/krping_dev.c Wed Dec 12 11:35:36 2018 (r341892) +++ stable/11/sys/contrib/rdma/krping/krping_dev.c Wed Dec 12 11:36:03 2018 (r341893) @@ -187,7 +187,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io err = uiomove(cp, amt, uio); if (err) { uprintf("Write failed: bad address!\n"); - return err; + goto done; } cp += amt; remain -= amt; @@ -195,7 +195,8 @@ krping_write(struct cdev *dev, struct uio *uio, int io if (uio->uio_resid != 0) { uprintf("Message too big. max size is %d!\n", BUFFERSIZE); - return EMSGSIZE; + err = EMSGSIZE; + goto done; } /* null terminate and remove the \n */ @@ -204,6 +205,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io krpingmsg->len = (unsigned long)(cp - krpingmsg->msg); uprintf("krping: write string = |%s|\n", krpingmsg->msg); err = krping_doit(krpingmsg->msg); +done: free(krpingmsg, M_DEVBUF); return(err); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121136.wBCBa3nU051770>