Date: Sat, 12 Apr 2014 14:18:48 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r264371 - stable/9/sys/kern Message-ID: <201404121418.s3CEImIp072584@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404121418.s3CEImIp072584>