File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ With that in mind, let’s learn about lifetimes.
4343Lending out a reference to a resource that someone else owns can be
4444complicated. For example, imagine this set of operations:
4545
46- - I acquire a handle to some kind of resource.
47- - I lend you a reference to the resource.
48- - I decide I’m done with the resource, and deallocate it, while you still have
46+ 1 . I acquire a handle to some kind of resource.
47+ 2 . I lend you a reference to the resource.
48+ 3 . I decide I’m done with the resource, and deallocate it, while you still have
4949 your reference.
50- - You decide to use the resource.
50+ 4 . You decide to use the resource.
5151
5252Uh oh! Your reference is pointing to an invalid resource. This is called a
5353dangling pointer or ‘use after free’, when the resource is memory.
You can’t perform that action at this time.
0 commit comments