Hi, Something looks funny, I'd agree. However, for posterity, it's legal and therefore safe to delete (and free) nullptr. Matt ----- Original Message ----- > From: "liuchang0812" <liuchang0812@xxxxxxxxx> > To: "ceph-devel" <ceph-devel@xxxxxxxxxxxxxxx> > Sent: Friday, March 17, 2017 5:58:14 AM > Subject: why do we delete target in RGWGetObjLayout constructed function? > > I saw this problem when i read RGW source code. It seems that that > `delete` a nullptr will segment fault. > > code[1]: > > class RGWGetObjLayout : public RGWOp { > protected: > RGWRados::Object *target{nullptr}; > RGWObjManifest *manifest{nullptr}; > rgw_raw_obj head_obj; > public: > RGWGetObjLayout() { > delete target; > } > > > [1]. https://github.com/ceph/ceph/blob/master/src/rgw/rgw_op.h#L1777 > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Matt Benjamin Red Hat, Inc. 315 West Huron Street, Suite 140A Ann Arbor, Michigan 48103 http://www.redhat.com/en/technologies/storage tel. 734-821-5101 fax. 734-769-8938 cel. 734-216-5309 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html