The patch for base/process/process_handle_openbsd.cc introduces a memory leak. Looking at similar patched files in chromium that call sysctl (e.g. base/process/process_metrics_openbsd.cc), this just seems to be a copy/paste error.
The diff at the bottom looks a bit messy. The diff between the original patched file and the new patched file looks as follows and shows more clearly what it achieves: ProcessId GetParentProcessId(ProcessHandle process) { struct kinfo_proc *info; size_t length; pid_t ppid; int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process, sizeof(struct kinfo_proc), 0 }; if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0) return -1; info = (struct kinfo_proc *)malloc(length); - if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0) - return -1; - - info = (struct kinfo_proc *)malloc(length); - mib[5] = (length / sizeof(struct kinfo_proc)); if (sysctl(mib, arraysize(mib), info, &length, NULL, 0) < 0) { ppid = -1; goto out; } ppid = info->p_ppid; out: free(info); return ppid; } Thanks, Caspar Schutijser Index: Makefile =================================================================== RCS file: /cvs/ports/www/chromium/Makefile,v retrieving revision 1.326 diff -u -p -r1.326 Makefile --- Makefile 25 Jun 2017 21:53:56 -0000 1.326 +++ Makefile 26 Jun 2017 15:11:36 -0000 @@ -8,6 +8,7 @@ DPB_PROPERTIES= parallel COMMENT= Chromium browser V= 59.0.3071.109 +REVISION= 0 DISTNAME= chromium-${V} DISTFILES= ${DISTNAME}${EXTRACT_SUFX} Index: patches/patch-base_process_process_handle_openbsd_cc =================================================================== RCS file: /cvs/ports/www/chromium/patches/patch-base_process_process_handle_openbsd_cc,v retrieving revision 1.2 diff -u -p -r1.2 patch-base_process_process_handle_openbsd_cc --- patches/patch-base_process_process_handle_openbsd_cc 6 Mar 2016 10:51:13 -0000 1.2 +++ patches/patch-base_process_process_handle_openbsd_cc 26 Jun 2017 15:11:36 -0000 @@ -1,6 +1,7 @@ $OpenBSD: patch-base_process_process_handle_openbsd_cc,v 1.2 2016/03/06 10:51:13 robert Exp $ ---- base/process/process_handle_openbsd.cc.orig.port Thu Mar 3 09:47:09 2016 -+++ base/process/process_handle_openbsd.cc Thu Mar 3 09:49:15 2016 +Index: base/process/process_handle_openbsd.cc +--- base/process/process_handle_openbsd.cc.orig ++++ base/process/process_handle_openbsd.cc @@ -6,6 +6,8 @@ #include "base/process/process_handle.h" @@ -10,7 +11,7 @@ $OpenBSD: patch-base_process_process_han #include <sys/sysctl.h> #include <sys/types.h> #include <unistd.h> -@@ -13,39 +15,64 @@ +@@ -13,39 +15,59 @@ namespace base { ProcessId GetParentProcessId(ProcessHandle process) { @@ -24,23 +25,18 @@ $OpenBSD: patch-base_process_process_han if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0) return -1; -- mib[5] = (length / sizeof(struct kinfo_proc)); + info = (struct kinfo_proc *)malloc(length); ++ + mib[5] = (length / sizeof(struct kinfo_proc)); - if (sysctl(mib, arraysize(mib), &info, &length, NULL, 0) < 0) -+ if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0) - return -1; - -- return info.p_ppid; -+ info = (struct kinfo_proc *)malloc(length); -+ -+ mib[5] = (length / sizeof(struct kinfo_proc)); -+ +- return -1; + if (sysctl(mib, arraysize(mib), info, &length, NULL, 0) < 0) { + ppid = -1; + goto out; + } -+ + +- return info.p_ppid; + ppid = info->p_ppid; + +out: