From: Matt Benjamin <mbenjamin@redhat.com>
To: liuchang0812 <liuchang0812@gmail.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: why do we delete target in RGWGetObjLayout constructed function?
Date: Sun, 19 Mar 2017 19:03:11 -0400 (EDT) [thread overview]
Message-ID: <1973705770.3254367.1489964591721.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CACKY0b_snoqrOhhXGFjZmypYx+zByyxNihjahRJQBtse3_Aw3A@mail.gmail.com>
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@gmail.com>
> To: "ceph-devel" <ceph-devel@vger.kernel.org>
> 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@vger.kernel.org
> 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
prev parent reply other threads:[~2017-03-19 23:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 9:58 why do we delete target in RGWGetObjLayout constructed function? liuchang0812
2017-03-17 10:08 ` liuchang0812
[not found] ` <13a064ed-c7b9-c495-ee36-246583eea4e1@redhat.com>
2017-03-17 11:11 ` liuchang0812
2017-03-19 23:03 ` Matt Benjamin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1973705770.3254367.1489964591721.JavaMail.zimbra@redhat.com \
--to=mbenjamin@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=liuchang0812@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox