Skip to content

Commit b955053

Browse files
committed
FIX: warning C6308 (possible memory leak)
1 parent 361b4d6 commit b955053

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/os/win32/host-lib.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ static void *Task_Ready;
838838
HANDLE hErrorWrite = 0, hErrorRead = 0;
839839
REBCHR *cmd = NULL;
840840
char *oem_input = NULL;
841+
void *tmp;
841842

842843
SECURITY_ATTRIBUTES sa;
843844

@@ -1121,8 +1122,9 @@ static void *Task_Ready;
11211122
*output_len += n;
11221123
if (*output_len >= output_size) {
11231124
output_size += BUF_SIZE_CHUNK;
1124-
*output = realloc(*output, output_size);
1125-
if (*output == NULL) goto kill;
1125+
tmp = realloc(*output, output_size);
1126+
if (tmp == NULL) goto kill;
1127+
*output = tmp;
11261128
}
11271129
}
11281130
} else if (handles[i] == hErrorRead) {
@@ -1135,8 +1137,9 @@ static void *Task_Ready;
11351137
*err_len += n;
11361138
if (*err_len >= err_size) {
11371139
err_size += BUF_SIZE_CHUNK;
1138-
*err = realloc(*err, err_size);
1139-
if (*err == NULL) goto kill;
1140+
tmp = realloc(*err, err_size);
1141+
if (tmp == NULL) goto kill;
1142+
*err = tmp;
11401143
}
11411144
}
11421145
} else {

0 commit comments

Comments
 (0)