svn commit: r264371 - stable/9/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sat Apr 12 14:18:48 UTC 2014


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

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

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

Modified: stable/9/sys/kern/kern_linker.c
==============================================================================
--- stable/9/sys/kern/kern_linker.c	Sat Apr 12 14:18:25 2014	(r264370)
+++ stable/9/sys/kern/kern_linker.c	Sat Apr 12 14:18:48 2014	(r264371)
@@ -733,14 +733,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:"


More information about the svn-src-stable-9 mailing list