]> granicus.if.org Git - taglib/commitdiff
Valgrind says home-brew strdup() is broken
authorWaldo Bastian <bastian@kde.org>
Mon, 12 Jul 2004 16:07:27 +0000 (16:07 +0000)
committerWaldo Bastian <bastian@kde.org>
Mon, 12 Jul 2004 16:07:27 +0000 (16:07 +0000)
Fixes saving of MP3 meta-info from properties dialog

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@328336 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

toolkit/taglib.h
toolkit/tfile.cpp

index 56e85c9c26b182d2722cfbf41e323947874cd9cf..1176b4a27094791cb5e6d858e74e6ca0839ed6e1 100644 (file)
@@ -71,18 +71,6 @@ namespace TagLib {
     uint refCount;
   };
 
-  /*!
-   * A simple strdup implementation since the standard one creates some wierdness
-   * with delete.
-   */
-  static inline char *strdup(const char *s)
-  {
-    const int l = ::strlen(s);
-    char *buffer = new char[l];
-    ::memcpy(buffer, s, l);
-    return buffer;
-  }
-
 #endif // DO_NOT_DOCUMENT
 
 }
index 1768469ddc1dc4e4c3b20bebdab630719e2f0e63..69db78956c907c8025bc5873ec6ba1610c184658 100644 (file)
@@ -41,7 +41,7 @@ public:
 
   ~FilePrivate()
   {
-    delete [] name;
+    free((void *)name);
   }
 
   FILE *file;
@@ -57,7 +57,7 @@ public:
 
 File::File(const char *file)
 {
-  d = new FilePrivate(strdup(file));
+  d = new FilePrivate(::strdup(file));
 
   d->readOnly = !isWritable(file);
   d->file = fopen(file, d->readOnly ? "r" : "r+");