Skip to content

Commit 67749b1

Browse files
cargo-credential-libsecret: don't allocate "url" C string
We already don't do this and use this precise idiom elsewhere
1 parent 1abdb1d commit 67749b1

File tree

1 file changed

+4
-4
lines changed
  • credential/cargo-credential-libsecret/src

1 file changed

+4
-4
lines changed

credential/cargo-credential-libsecret/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ mod linux {
168168

169169
let index_url_c = CString::new(registry.index_url).unwrap();
170170
let mut error: *mut GError = null_mut();
171-
let attr_url = CString::new("url").unwrap();
171+
let attr_url = b"url\0".as_ptr() as *const gchar;
172172
let schema = schema();
173173
match action {
174174
cargo_credential::Action::Get(_) => {
@@ -177,7 +177,7 @@ mod linux {
177177
&schema,
178178
null_mut(),
179179
&mut error,
180-
attr_url.as_ptr(),
180+
attr_url,
181181
index_url_c.as_ptr(),
182182
null() as *const gchar,
183183
);
@@ -217,7 +217,7 @@ mod linux {
217217
token.as_ptr(),
218218
null_mut(),
219219
&mut error,
220-
attr_url.as_ptr(),
220+
attr_url,
221221
index_url_c.as_ptr(),
222222
null() as *const gchar,
223223
);
@@ -239,7 +239,7 @@ mod linux {
239239
&schema,
240240
null_mut(),
241241
&mut error,
242-
attr_url.as_ptr(),
242+
attr_url,
243243
index_url_c.as_ptr(),
244244
null() as *const gchar,
245245
);

0 commit comments

Comments
 (0)