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:
Michael Drake 2020-02-24 14:34:37 +00:00
parent b8dc537bf8
commit 63dd59bd2e

View File

@ -1159,6 +1159,11 @@ read_entries(struct store_state *state)
uint32_t urllen;
while (read(fd, &urllen, sizeof(urllen)) == sizeof(urllen)) {
url = calloc(1, urllen+1);
if (url == NULL) {
close(fd);
free(fname);
return NSERROR_NOMEM;
}
if (read(fd, url, urllen) != urllen) {
free(url);
close(fd);