Commit a0319947 authored by npzacs's avatar npzacs
Browse files

Check for failed calloc()

parent 7957233a
......@@ -399,6 +399,10 @@ MMCDEV *device_open(const char *path)
int rc;
dev = calloc(1, sizeof(MMCDEV));
if (!dev) {
BD_DEBUG(DBG_MKB | DBG_CRIT, "out of memory\n");
return NULL;
}
rc = mmc_open_iokit (path, dev);
if (0 != rc) {
......
......@@ -161,6 +161,12 @@ MMCDEV *device_open(const char *path)
BD_DEBUG(DBG_MMC, "Windows MMC drive %s opened\n", volume);
dev = calloc(1, sizeof(MMCDEV));
if (!dev) {
BD_DEBUG(DBG_MKB | DBG_CRIT, "out of memory\n");
CloseHandle(fd);
return NULL;
}
dev->fd = fd;
return dev;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment