]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fix null pointer crush
authorgaosibei <gaosb@inspur.com>
Fri, 10 Nov 2017 02:11:26 +0000 (10:11 +0800)
committergaosibei <gaosb@inspur.com>
Mon, 13 Nov 2017 04:52:16 +0000 (12:52 +0800)
Signed-off-by: Sibei Gao <gaosb@inspur.com>
src/rgw/rgw_rados.cc

index 27f313110db6c16e62a4be111450650596293bf3..98a0570a38ee0abc65e62cd2c8ea0e49ab953feb 100644 (file)
@@ -5900,7 +5900,11 @@ int RGWRados::select_bucket_location_by_rule(const string& location_rule, RGWZon
     /* we can only reach here if we're trying to set a bucket location from a bucket
      * created on a different zone, using a legacy / default pool configuration
      */
-    return select_legacy_bucket_placement(rule_info);
+    if (rule_info) {
+      return select_legacy_bucket_placement(rule_info);
+    }
+
+    return 0;
   }
 
   /*
@@ -5942,7 +5946,11 @@ int RGWRados::select_bucket_placement(RGWUserInfo& user_info, const string& zone
     pselected_rule_name->clear();
   }
 
-  return select_legacy_bucket_placement(rule_info);
+  if (rule_info) {
+    return select_legacy_bucket_placement(rule_info);
+  }
+
+  return 0;
 }
 
 int RGWRados::select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info)