summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2014-05-29 11:05:16 (GMT)
committerBen Brewer <ben.brewer@codethink.co.uk>2014-06-02 10:03:00 (GMT)
commite36bf9fe7ea9509c9bff5e5eb1d323da919428ef (patch)
treef8ac823525d15a51f70c2e6a2662538396ab5f7c
parent2e3bf668ae17aee6a499e8332541516ecc92e5b0 (diff)
downloadtbdiff-e36bf9fe7ea9509c9bff5e5eb1d323da919428ef.tar.gz
Fix memory leak of name in tbdiff-stat.c
On error the duplicated string in 'name' would have leaked.
-rw-r--r--tbdiff/tbdiff-stat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tbdiff/tbdiff-stat.c b/tbdiff/tbdiff-stat.c
index fd8964e..66e2caf 100644
--- a/tbdiff/tbdiff-stat.c
+++ b/tbdiff/tbdiff-stat.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Codethink Ltd.
+ * Copyright (C) 2011-2014 Codethink Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
@@ -144,8 +144,10 @@ tbd_stat_entry(tbd_stat_t *file, uint32_t entry)
closedir (dp);
char *spath = tbd_stat_subpath(file, name);
- if(spath == NULL)
+ if(spath == NULL) {
+ free(name);
return NULL;
+ }
tbd_stat_t *ret = tbd_stat_from_path(name, (const char*)spath);