summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-02-12 22:58:24 +0100
committerVolker Lendecke <vl@samba.org>2009-02-12 23:02:53 +0100
commit1b6543c5f9acea16b1ec4cf6d7c46283732b4522 (patch)
tree1c567cebfd0be95269c86062050c02df0e6ffbf0 /source3/client
parent5cd4b7b7c03df6e896186d985b6858a06aa40b3f (diff)
downloadsamba-1b6543c5f9acea16b1ec4cf6d7c46283732b4522.tar.gz
samba-1b6543c5f9acea16b1ec4cf6d7c46283732b4522.tar.bz2
samba-1b6543c5f9acea16b1ec4cf6d7c46283732b4522.zip
Fix Coverity IDs 879 and 880 (RESOURCE_LEAK, REVERSE_INULL)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/umount.cifs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/client/umount.cifs.c b/source3/client/umount.cifs.c
index 81925eda27..1227e7a204 100644
--- a/source3/client/umount.cifs.c
+++ b/source3/client/umount.cifs.c
@@ -240,10 +240,9 @@ static int remove_from_mtab(char * mountpoint)
static char *
canonicalize(char *path)
{
- char *canonical = malloc (PATH_MAX + 1);
+ char *canonical;
- if (!canonical) {
- fprintf(stderr, "Error! Not enough memory!\n");
+ if (path == NULL) {
return NULL;
}
@@ -252,8 +251,12 @@ canonicalize(char *path)
return NULL;
}
- if (path == NULL)
+ canonical = (char *)malloc (PATH_MAX + 1);
+
+ if (!canonical) {
+ fprintf(stderr, "Error! Not enough memory!\n");
return NULL;
+ }
if (realpath (path, canonical))
return canonical;