rust/lockfile: Use from_glib_full to avoid manual free

This is cleaner.
This commit is contained in:
Colin Walters 2020-11-04 00:38:44 +00:00 committed by OpenShift Merge Robot
parent 96c2d8998d
commit 10906f4a00

View File

@ -260,17 +260,15 @@ mod ffi {
if r == 0 { if r == 0 {
return r; return r;
} }
let chksum: String = unsafe { from_glib_full(chksum) };
lockfile.packages.insert( lockfile.packages.insert(
name.as_str().to_string(), name.as_str().to_string(),
LockedPackage { LockedPackage {
evra: format!("{}.{}", evr.as_str(), arch.as_str()), evra: format!("{}.{}", evr.as_str(), arch.as_str()),
digest: Some(unsafe { from_glib_none(chksum) }), digest: Some(chksum),
}, },
); );
// forgive me for this sin... need to oxidize chksum_repr()
unsafe { glib_sys::g_free(chksum as *mut libc::c_void) };
} }
/* just take the ref here to be less verbose */ /* just take the ref here to be less verbose */