mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-02 11:43:23 +00:00
added NULL check and memory leak fixed in libr/util/w32-sys.c
This commit is contained in:
parent
949efc35e8
commit
5df164157f
@ -128,15 +128,20 @@ char *ReadFromPipe(HANDLE fh) {
|
||||
int strsz = BUFSIZE+1;
|
||||
|
||||
str = malloc (strsz);
|
||||
if (!str) {
|
||||
return NULL;
|
||||
}
|
||||
for (;;) {
|
||||
bSuccess = ReadFile (fh, chBuf, BUFSIZE, &dwRead, NULL);
|
||||
if (!bSuccess || dwRead == 0) {
|
||||
break;
|
||||
}
|
||||
if (strl+dwRead>strsz) {
|
||||
char *str_tmp = str;
|
||||
strsz += 4096;
|
||||
str = realloc (str, strsz);
|
||||
if (!str) {
|
||||
free (str_tmp);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user