Author: kan
Date: Sat Dec 23 16:23:58 2017
New Revision: 327108
URL: https://svnweb.freebsd.org/changeset/base/327108

Log:
  Do not double free the memory in if_clone.
  
  if_clone_attach function will drop the reference on failure  which will
  free the if_clone structure. No need to do it second time.
  
  Reviewed by: glebius, ae
  Differential Revision: https://reviews.freebsd.org/D10386

Modified:
  head/sys/net/if_clone.c

Modified: head/sys/net/if_clone.c
==============================================================================
--- head/sys/net/if_clone.c     Sat Dec 23 14:30:44 2017        (r327107)
+++ head/sys/net/if_clone.c     Sat Dec 23 16:23:58 2017        (r327108)
@@ -387,10 +387,8 @@ if_clone_advanced(const char *name, u_int maxunit, ifc
        ifc->ifc_create = create;
        ifc->ifc_destroy = destroy;
 
-       if (if_clone_attach(ifc) != 0) {
-               if_clone_free(ifc);
+       if (if_clone_attach(ifc) != 0)
                return (NULL);
-       }
 
        EVENTHANDLER_INVOKE(if_clone_event, ifc);
 
@@ -410,10 +408,8 @@ if_clone_simple(const char *name, ifcs_create_t create
        ifc->ifcs_destroy = destroy;
        ifc->ifcs_minifs = minifs;
 
-       if (if_clone_attach(ifc) != 0) {
-               if_clone_free(ifc);
+       if (if_clone_attach(ifc) != 0)
                return (NULL);
-       }
 
        for (unit = 0; unit < minifs; unit++) {
                char name[IFNAMSIZ];
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to