Skip to content

Commit ca81a1b

Browse files
committed
---
yaml --- r: 234847 b: refs/heads/stable c: 2148567 h: refs/heads/master i: 234845: 0aea4bc 234843: 11f397a 234839: ce8e2a0 234831: 63191d1 234815: 54aaff5 v: v3
1 parent d8dffdc commit ca81a1b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: b107af3ada920f6902ee4cbed08858013ea60177
32+
refs/heads/stable: 2148567821b0e3ff63e13b652b9b645263b70cb0
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libstd/sys/windows/os.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ impl ExactSizeIterator for Args {
311311

312312
impl Drop for Args {
313313
fn drop(&mut self) {
314-
// NULL-safe
314+
// self.cur can be null if CommandLineToArgvW previously failed,
315+
// but LocalFree ignores NULL pointers
315316
unsafe { c::LocalFree(self.cur as *mut c_void); }
316317
}
317318
}
@@ -322,8 +323,9 @@ pub fn args() -> Args {
322323
let lpCmdLine = c::GetCommandLineW();
323324
let szArgList = c::CommandLineToArgvW(lpCmdLine, &mut nArgs);
324325

325-
// cur may be NULL if CommandLineToArgvW failed,
326-
// in which case the range is empty to prevent reads
326+
// szArcList can be NULL if CommandLinToArgvW failed,
327+
// but in that case nArgs is 0 so we won't actually
328+
// try to read a null pointer
327329
Args { cur: szArgList, range: 0..(nArgs as isize) }
328330
}
329331
}

0 commit comments

Comments
 (0)