summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorEd Maste <emaste@freebsd.org>2014-08-07 19:28:02 +0000
committerEd Maste <emaste@freebsd.org>2014-08-07 19:28:02 +0000
commit42461e9f1325aeb4d2dadd6b02bbdea5151268f6 (patch)
tree43139fe8d7d84d525c1c92f1034d5f7b6b90aee8 /lldb/source
parenta02d6255133b90e87383411c51a169f87615429c (diff)
downloadbcm5719-llvm-42461e9f1325aeb4d2dadd6b02bbdea5151268f6.tar.gz
bcm5719-llvm-42461e9f1325aeb4d2dadd6b02bbdea5151268f6.zip
Use standard realloc so FreeBSD Host.cpp can use glibc
To fix building on Debian GNU/kFreeBSD, which uses the FreeBSD kernel with a GNU userland. llvm-svn: 215134
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Host/freebsd/Host.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp
index 4f6af67dbd0..8376463561b 100644
--- a/lldb/source/Host/freebsd/Host.cpp
+++ b/lldb/source/Host/freebsd/Host.cpp
@@ -86,7 +86,7 @@ Host::ThreadCreated (const char *thread_name)
std::string
Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid)
{
- struct kinfo_proc *kp = nullptr;
+ struct kinfo_proc *kp = nullptr, *nkp;
size_t len = 0;
int error;
int name[4] = {
@@ -98,9 +98,13 @@ Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid)
if (kp == nullptr || (error != 0 && errno == ENOMEM)) {
// Add extra space in case threads are added before next call.
len += sizeof(*kp) + len / 10;
- kp = (struct kinfo_proc *)reallocf(kp, len);
- if (kp == nullptr)
+ nkp = (struct kinfo_proc *)realloc(kp, len);
+ if (nkp == nullptr)
+ {
+ free(kp);
return std::string();
+ }
+ kp = nkp;
continue;
}
if (error != 0)
OpenPOWER on IntegriCloud