We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Drop
SpecString
CVec
1 parent a2ddae3 commit 51d5388Copy full SHA for 51d5388
crates/rust-url/src/lib.rs
@@ -444,8 +444,10 @@ pub struct CVec<T> {
444
445
impl<T> Drop for CVec<T> {
446
fn drop(&mut self) {
447
- unsafe {
448
- self.ptr.drop_in_place();
+ if !self.ptr.is_null() && self.cap != 0 {
+ unsafe {
449
+ let _ = Vec::from_raw_parts(self.ptr, self.len, self.cap);
450
+ }
451
}
452
453
@@ -490,8 +492,10 @@ impl<'a> From<&'a SpecString> for &'a str {
490
492
491
493
impl Drop for SpecString {
494
- self.data.drop_in_place();
495
+ if !self.data.is_null() && self.cap != 0 {
496
497
+ let _ = String::from_raw_parts(self.data, self.len, self.cap);
498
499
500
501
0 commit comments