drm2(4): Fix double-free in low-memory error path

Reallocf frees 'block'; don't attempt to free it again.

Reported by:	Coverity
CID:		1091165
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
cem 2016-04-20 03:45:45 +00:00
parent ccb64ff382
commit 0016129945

View File

@ -353,8 +353,10 @@ drm_do_get_edid(struct drm_connector *connector, device_t adapter)
new = reallocf(block, (block[0x7e] + 1) * EDID_LENGTH, DRM_MEM_KMS,
M_NOWAIT);
if (!new)
if (!new) {
block = NULL;
goto out;
}
block = new;
for (j = 1; j <= block[0x7e]; j++) {