Date: Sat, 5 Apr 2014 20:44:53 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264173 - head/sys/kern Message-ID: <201404052044.s35KirsT078506@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Apr 5 20:44:52 2014 New Revision: 264173 URL: http://svnweb.freebsd.org/changeset/base/264173 Log: Use realloc(9) instead of doing the reallocation inline. Submitted by: bde MFC after: 1 week Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Apr 5 20:26:17 2014 (r264172) +++ head/sys/kern/kern_linker.c Sat Apr 5 20:44:52 2014 (r264173) @@ -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:"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404052044.s35KirsT078506>