mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
Cache backing store: Add missing calloc check.
Found by coverity: CID 1419831: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL" "url" when calling "read".
This commit is contained in:
parent
b8dc537bf8
commit
63dd59bd2e
@ -1159,6 +1159,11 @@ read_entries(struct store_state *state)
|
|||||||
uint32_t urllen;
|
uint32_t urllen;
|
||||||
while (read(fd, &urllen, sizeof(urllen)) == sizeof(urllen)) {
|
while (read(fd, &urllen, sizeof(urllen)) == sizeof(urllen)) {
|
||||||
url = calloc(1, urllen+1);
|
url = calloc(1, urllen+1);
|
||||||
|
if (url == NULL) {
|
||||||
|
close(fd);
|
||||||
|
free(fname);
|
||||||
|
return NSERROR_NOMEM;
|
||||||
|
}
|
||||||
if (read(fd, url, urllen) != urllen) {
|
if (read(fd, url, urllen) != urllen) {
|
||||||
free(url);
|
free(url);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user