From b2eb6640fbe09968f82a42f6a993b854af8b62cd Mon Sep 17 00:00:00 2001 From: shirou Date: Sat, 23 Mar 2019 09:48:18 +0900 Subject: [PATCH] [disk][windows]: does not define ret at begining of the function. To reduce memory when error happend. commented on #653. --- disk/disk_windows.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/disk/disk_windows.go b/disk/disk_windows.go index 081443b..02c965d 100644 --- a/disk/disk_windows.go +++ b/disk/disk_windows.go @@ -40,8 +40,6 @@ func Usage(path string) (*UsageStat, error) { } func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { - ret := &UsageStat{} - lpFreeBytesAvailable := int64(0) lpTotalNumberOfBytes := int64(0) lpTotalNumberOfFreeBytes := int64(0) @@ -53,7 +51,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { if diskret == 0 { return nil, err } - ret = &UsageStat{ + ret := &UsageStat{ Path: path, Total: uint64(lpTotalNumberOfBytes), Free: uint64(lpTotalNumberOfFreeBytes),