svn commit: r285697 - head/sys/dev/netmap

Luigi Rizzo luigi at FreeBSD.org
Sun Jul 19 18:05:50 UTC 2015


Author: luigi
Date: Sun Jul 19 18:05:49 2015
New Revision: 285697
URL: https://svnweb.freebsd.org/changeset/base/285697

Log:
  do not free NULL if pipe allocation fails

Modified:
  head/sys/dev/netmap/netmap_pipe.c

Modified: head/sys/dev/netmap/netmap_pipe.c
==============================================================================
--- head/sys/dev/netmap/netmap_pipe.c	Sun Jul 19 18:04:51 2015	(r285696)
+++ head/sys/dev/netmap/netmap_pipe.c	Sun Jul 19 18:05:49 2015	(r285697)
@@ -616,7 +616,7 @@ netmap_get_pipe_na(struct nmreq *nmr, st
 	sna = malloc(sizeof(*mna), M_DEVBUF, M_NOWAIT | M_ZERO);
 	if (sna == NULL) {
 		error = ENOMEM;
-		goto free_mna;
+		goto unregister_mna;
 	}
 	/* most fields are the same, copy from master and then fix */
 	*sna = *mna;
@@ -666,6 +666,8 @@ found:
 
 free_sna:
 	free(sna, M_DEVBUF);
+unregister_mna:
+	netmap_pipe_remove(pna, mna);
 free_mna:
 	free(mna, M_DEVBUF);
 put_out:


More information about the svn-src-head mailing list