]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: avoid taking inode ref in case of nonexistent dir
authorAndrey Stepachev <octo@yandex-team.ru>
Thu, 12 Jan 2012 15:26:34 +0000 (19:26 +0400)
committerSage Weil <sage@newdream.net>
Thu, 12 Jan 2012 18:38:33 +0000 (10:38 -0800)
Signed-off-by: Andrey Stepachev <octo@yandex-team.ru>
Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc

index 0aed0b285e1ebc8029cc2050b21c0a193931b8f5..c0cebcb9b226975d4c161b2d98c7d5b15be388e4 100644 (file)
@@ -4140,9 +4140,9 @@ int Client::opendir(const char *relpath, dir_result_t **dirpp)
 
 int Client::_opendir(Inode *in, dir_result_t **dirpp, int uid, int gid) 
 {
-  *dirpp = new dir_result_t(in);
   if (!in->is_dir())
     return -ENOTDIR;
+  *dirpp = new dir_result_t(in);
   (*dirpp)->set_frag(in->dirfragtree[0]);
   if (in->dir)
     (*dirpp)->release_count = in->dir->release_count;