Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2018 13:27:48 +0000 (UTC)
From:      Slava Shwartsman <slavash@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341539 - head/sys/contrib/rdma/krping
Message-ID:  <201812051327.wB5DRmic070612@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: slavash
Date: Wed Dec  5 13:27:48 2018
New Revision: 341539
URL: https://svnweb.freebsd.org/changeset/base/341539

Log:
  krping: Fix for memory leak in error case.
  
  Submitted by:   hselasky@
  Approved by:    hselasky (mentor)
  MFC after:      1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/contrib/rdma/krping/krping_dev.c

Modified: head/sys/contrib/rdma/krping/krping_dev.c
==============================================================================
--- head/sys/contrib/rdma/krping/krping_dev.c	Wed Dec  5 13:27:17 2018	(r341538)
+++ head/sys/contrib/rdma/krping/krping_dev.c	Wed Dec  5 13:27:48 2018	(r341539)
@@ -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?201812051327.wB5DRmic070612>