Author: kib
Date: Sat Apr 12 14:18:25 2014
New Revision: 264370
URL: http://svnweb.freebsd.org/changeset/base/264370

Log:
  MFC r264173:
  Use realloc(9) instead of doing the reallocation inline.

Modified:
  stable/10/sys/kern/kern_linker.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_linker.c
==============================================================================
--- stable/10/sys/kern/kern_linker.c    Sat Apr 12 14:09:35 2014        
(r264369)
+++ stable/10/sys/kern/kern_linker.c    Sat Apr 12 14:18:25 2014        
(r264370)
@@ -725,14 +725,8 @@ linker_file_add_dependency(linker_file_t
        linker_file_t *newdeps;
 
        sx_assert(&kld_sx, SA_XLOCKED);
-       newdeps = malloc((file->ndeps + 1) * sizeof(*newdeps), M_LINKER,
-           M_WAITOK | M_ZERO);
-
-       if (file->deps) {
-               bcopy(file->deps, newdeps, file->ndeps * sizeof(*newdeps));
-               free(file->deps, M_LINKER);
-       }
-       file->deps = newdeps;
+       file->deps = realloc(file->deps, (file->ndeps + 1) * sizeof(*newdeps),
+           M_LINKER, M_WAITOK | M_ZERO);
        file->deps[file->ndeps] = dep;
        file->ndeps++;
        KLD_DPF(FILE, ("linker_file_add_dependency:"
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to