[Lldb-commits] [lldb] r215134 - Use standard realloc so FreeBSD Host.cpp can use glibc

Ed Maste emaste at freebsd.org
Thu Aug 7 12:28:02 PDT 2014


Author: emaste
Date: Thu Aug  7 14:28:02 2014
New Revision: 215134

URL: http://llvm.org/viewvc/llvm-project?rev=215134&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Host/freebsd/Host.cpp

Modified: lldb/trunk/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=215134&r1=215133&r2=215134&view=diff
==============================================================================
--- lldb/trunk/source/Host/freebsd/Host.cpp (original)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Thu Aug  7 14:28:02 2014
@@ -86,7 +86,7 @@ Host::ThreadCreated (const char *thread_
 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, ll
         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)





More information about the lldb-commits mailing list