From 806964f852773e427fea82a7716d44ce3be4498c Mon Sep 17 00:00:00 2001
From: Felix Janda <felix.janda@posteo.de>
Date: Sun, 1 Feb 2015 14:27:32 +0100
Subject: [PATCH 2/3] Avoid using basename

---
 src/common/linux/dump_symbols.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index d029ca14..6ac4a17b 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -881,9 +881,9 @@ const char* ElfArchitecture(const typename ElfClass::Ehdr* elf_header) {
 // last slash, or the whole filename if there are no slashes.
 string BaseFileName(const string &filename) {
   // Lots of copies!  basename's behavior is less than ideal.
-  char* c_filename = strdup(filename.c_str());
-  string base = basename(c_filename);
-  free(c_filename);
+  const char *c_filename = filename.c_str();
+  const char *p = strrchr(c_filename, '/');
+  string base = p ? p+1 : c_filename;
   return base;
 }
 
-- 
2.14.1

