Skip to content

Commit

Permalink
[Decode] Fix kw issues
Browse files Browse the repository at this point in the history
Possible memory leak

Change-Id: I2f22b4135d8e25d11afa8385ae45702eb1b97b09
  • Loading branch information
shawnli2 authored and Sherry-Lin committed Jul 25, 2019
1 parent dab49ad commit 2144622
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions media_driver/linux/common/ddi/media_libva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,7 @@ DdiMedia_CreateSurfaces2(
surfDesc->uiTile = I915_TILING_NONE;
if (surfDesc->ulBuffer % 4096 != 0)
{
MOS_FreeMemory(surfDesc);
DDI_VERBOSEMESSAGE("Buffer Address is invalid");
return VA_STATUS_ERROR_INVALID_PARAMETER;
}
Expand Down
1 change: 1 addition & 0 deletions media_driver/linux/common/ddi/media_libva_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ PDDI_MEDIA_SURFACE DdiMedia_ReplaceSurfaceWithNewFormat(PDDI_MEDIA_SURFACE surfa
PDDI_MEDIA_SURFACE dstSurface = (DDI_MEDIA_SURFACE *)MOS_AllocAndZeroMemory(sizeof(DDI_MEDIA_SURFACE));
if (nullptr == surfaceElement)
{
MOS_FreeMemory(dstSurface);
return nullptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,13 @@ VAStatus DdiMedia_PutSurfaceLinuxSW(
uint8_t *umdContextY = dispTempBuffer;
uint8_t *ptr = (uint8_t*)DdiMediaUtil_LockSurface(mediaSurface, (MOS_LOCKFLAG_READONLY | MOS_LOCKFLAG_WRITEONLY));
MOS_STATUS eStatus = MOS_SecureMemcpy(umdContextY, surfaceSize, ptr, surfaceSize);
DDI_CHK_CONDITION((eStatus != MOS_STATUS_SUCCESS), "DDI:Failed to copy surface buffer data!", VA_STATUS_ERROR_OPERATION_FAILED);

if (eStatus != MOS_STATUS_SUCCESS)
{
MOS_FreeMemory(dispTempBuffer);
DDI_ASSERTMESSAGE("DDI:Failed to copy surface buffer data!");
return VA_STATUS_ERROR_OPERATION_FAILED;
}

Visual *visual = DefaultVisual(ctx->native_dpy, ctx->x11_screen);
GC gc = (*pfn_XCreateGC)((Display*)ctx->native_dpy, (Drawable)draw, 0, nullptr);
Expand Down
1 change: 1 addition & 0 deletions media_driver/linux/common/os/i915/mos_bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3979,6 +3979,7 @@ struct drm_i915_gem_vm_control* mos_gem_vm_create(struct mos_bufmgr *bufmgr)
if (ret != 0) {
MOS_DBG("DRM_IOCTL_I915_GEM_VM_CREATE failed: %s\n",
strerror(errno));
free(vm);
return nullptr;
}

Expand Down
3 changes: 3 additions & 0 deletions media_driver/linux/common/os/mos_utilities_specific.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ static MOS_STATUS _UserFeature_SetValue(

if ( (eStatus = _UserFeature_DumpFile(szUserFeatureFile, &pKeyList)) != MOS_STATUS_SUCCESS )
{
MOS_FreeMemory(pKeyList);
return eStatus;
}

Expand Down Expand Up @@ -1330,6 +1331,7 @@ static MOS_STATUS _UserFeature_GetKeyIdbyName(const char *pcKeyName, void **pUF
if ( (eStatus = _UserFeature_DumpFile(szUserFeatureFile, &pKeyList)) !=
MOS_STATUS_SUCCESS )
{
MOS_FreeMemory(pKeyList);
return eStatus;
}

Expand Down Expand Up @@ -1382,6 +1384,7 @@ static MOS_STATUS _UserFeature_GetKeyNamebyId(void *UFKey, char *pcKeyName)
if ( (eStatus = _UserFeature_DumpFile(szUserFeatureFile, &pKeyList)) !=
MOS_STATUS_SUCCESS )
{
MOS_FreeMemory(pKeyList);
return eStatus;
}

Expand Down

0 comments on commit 2144622

Please sign in to comment.