Changed patch wording
This commit is contained in:
parent
b107af3ada
commit
2148567821
1 changed files with 5 additions and 3 deletions
|
|
@ -311,7 +311,8 @@ impl ExactSizeIterator for Args {
|
|||
|
||||
impl Drop for Args {
|
||||
fn drop(&mut self) {
|
||||
// NULL-safe
|
||||
// self.cur can be null if CommandLineToArgvW previously failed,
|
||||
// but LocalFree ignores NULL pointers
|
||||
unsafe { c::LocalFree(self.cur as *mut c_void); }
|
||||
}
|
||||
}
|
||||
|
|
@ -322,8 +323,9 @@ pub fn args() -> Args {
|
|||
let lpCmdLine = c::GetCommandLineW();
|
||||
let szArgList = c::CommandLineToArgvW(lpCmdLine, &mut nArgs);
|
||||
|
||||
// cur may be NULL if CommandLineToArgvW failed,
|
||||
// in which case the range is empty to prevent reads
|
||||
// szArcList can be NULL if CommandLinToArgvW failed,
|
||||
// but in that case nArgs is 0 so we won't actually
|
||||
// try to read a null pointer
|
||||
Args { cur: szArgList, range: 0..(nArgs as isize) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue