diff options
author | Nikias Bassen | 2013-09-19 08:53:25 +0200 |
---|---|---|
committer | Nikias Bassen | 2013-09-19 08:53:25 +0200 |
commit | cab6533e63e390dccda15391cf3988e4d706a958 (patch) | |
tree | 07ff62ed66fa38a53c727cd455ab468fe0931d13 /common | |
parent | e53fcd1dd30f7dcd3c496ef25c3dea197e928ce7 (diff) | |
download | libimobiledevice-cab6533e63e390dccda15391cf3988e4d706a958.tar.gz libimobiledevice-cab6533e63e390dccda15391cf3988e4d706a958.tar.bz2 |
userpref: fix leak and possible endless recursion in mkdir_with_parents
Diffstat (limited to 'common')
-rw-r--r-- | common/userpref.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/common/userpref.c b/common/userpref.c index 231d456..ec1b182 100644 --- a/common/userpref.c +++ b/common/userpref.c @@ -250,16 +250,13 @@ static int mkdir_with_parents(const char *dir, int mode) } int res; char *parent = strdup(dir); - parent = dirname(parent); - if (parent) { - res = mkdir_with_parents(parent, mode); + char* parentdir = dirname(parent); + if (parentdir) { + res = mkdir_with_parents(parentdir, mode); } else { - res = -1; + res = -1; } free(parent); - if (res == 0) { - mkdir_with_parents(dir, mode); - } return res; } |