[disk][windows]: does not define ret at begining of the function.
To reduce memory when error happend. commented on #653.
This commit is contained in:
parent
2689fdca83
commit
b2eb6640fb
|
@ -40,8 +40,6 @@ func Usage(path string) (*UsageStat, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
|
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
|
||||||
ret := &UsageStat{}
|
|
||||||
|
|
||||||
lpFreeBytesAvailable := int64(0)
|
lpFreeBytesAvailable := int64(0)
|
||||||
lpTotalNumberOfBytes := int64(0)
|
lpTotalNumberOfBytes := int64(0)
|
||||||
lpTotalNumberOfFreeBytes := int64(0)
|
lpTotalNumberOfFreeBytes := int64(0)
|
||||||
|
@ -53,7 +51,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
|
||||||
if diskret == 0 {
|
if diskret == 0 {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ret = &UsageStat{
|
ret := &UsageStat{
|
||||||
Path: path,
|
Path: path,
|
||||||
Total: uint64(lpTotalNumberOfBytes),
|
Total: uint64(lpTotalNumberOfBytes),
|
||||||
Free: uint64(lpTotalNumberOfFreeBytes),
|
Free: uint64(lpTotalNumberOfFreeBytes),
|
||||||
|
|
Loading…
Reference in New Issue