Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 11:35:36 +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-12@freebsd.org
Subject:   svn commit: r341892 - stable/12/sys/contrib/rdma/krping
Message-ID:  <201812121135.wBCBZaPL051701@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 12 11:35:36 2018
New Revision: 341892
URL: https://svnweb.freebsd.org/changeset/base/341892

Log:
  MFC r341539:
  krping: Fix for memory leak in error case.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/12/sys/contrib/rdma/krping/krping_dev.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/rdma/krping/krping_dev.c
==============================================================================
--- stable/12/sys/contrib/rdma/krping/krping_dev.c	Wed Dec 12 11:35:00 2018	(r341891)
+++ stable/12/sys/contrib/rdma/krping/krping_dev.c	Wed Dec 12 11:35:36 2018	(r341892)
@@ -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?201812121135.wBCBZaPL051701>