mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-13 06:01:03 +00:00
Check for realloc failures in bflsc driver.
This commit is contained in:
parent
b0f8b278ca
commit
4c8acdf9dc
@ -346,6 +346,8 @@ static bool tolines(struct cgpu_info *bflsc, int dev, char *buf, int *lines, cha
|
|||||||
ptr = strdup(buf);
|
ptr = strdup(buf);
|
||||||
while (ptr && *ptr) {
|
while (ptr && *ptr) {
|
||||||
p_items = realloc(p_items, ++p_lines * sizeof(*p_items));
|
p_items = realloc(p_items, ++p_lines * sizeof(*p_items));
|
||||||
|
if (unlikely(!p_items))
|
||||||
|
quit(1, "Failed to realloc p_items in tolines");
|
||||||
p_items[p_lines-1] = ptr;
|
p_items[p_lines-1] = ptr;
|
||||||
ptr = strchr(ptr, '\n');
|
ptr = strchr(ptr, '\n');
|
||||||
if (ptr)
|
if (ptr)
|
||||||
@ -430,6 +432,8 @@ static bool breakdown(enum breakmode mode, char *buf, int *count, char **firstna
|
|||||||
if (comma)
|
if (comma)
|
||||||
*(comma++) = '\0';
|
*(comma++) = '\0';
|
||||||
p_fields = realloc(p_fields, ++p_count * sizeof(*p_fields));
|
p_fields = realloc(p_fields, ++p_count * sizeof(*p_fields));
|
||||||
|
if (unlikely(!p_fields))
|
||||||
|
quit(1, "Failed to realloc p_fields in breakdown");
|
||||||
p_fields[p_count-1] = ptr;
|
p_fields[p_count-1] = ptr;
|
||||||
ptr = comma;
|
ptr = comma;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user