summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-02-05 10:12:14 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-02-05 10:12:14 +0100
commit32e0b131c9d814eac97629a5ca693e8891daf6c3 (patch)
tree85775731b92918e13a0b1b98d595e1342421bc48 /tools.c
parent9484b537bc9adeb41e5938079f272e2ddf091df5 (diff)
downloadvdr-32e0b131c9d814eac97629a5ca693e8891daf6c3.tar.gz
vdr-32e0b131c9d814eac97629a5ca693e8891daf6c3.tar.bz2
Fixed a memory leak in AddDirectory() and strescape()
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools.c b/tools.c
index 2f130c78..0501d76d 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.88 2005/01/16 11:47:44 kls Exp $
+ * $Id: tools.c 1.89 2005/02/05 10:10:30 kls Exp $
*/
#include "tools.h"
@@ -199,7 +199,7 @@ cString strescape(const char *s, const char *chars)
}
if (t)
*t = 0;
- return s;
+ return cString(s, t != NULL);
}
bool startswith(const char *s, const char *p)
@@ -250,7 +250,7 @@ cString AddDirectory(const char *DirName, const char *FileName)
{
char *buf;
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
- return buf;
+ return cString(buf, true);
}
cString itoa(int n)
@@ -513,9 +513,9 @@ uint64 cTimeMs::Elapsed(void)
// --- cString ---------------------------------------------------------------
-cString::cString(const char *S)
+cString::cString(const char *S, bool TakePointer)
{
- s = S ? strdup(S) : NULL;
+ s = TakePointer ? (char *)S : S ? strdup(S) : NULL;
}
cString::~cString()