4777032 MdeModulePkg DxeCore: Only free ScratchBuffer when it is not NULL

Authored and Committed by Star Zeng 6 years ago
    MdeModulePkg DxeCore: Only free ScratchBuffer when it is not NULL
    
    There is a case that ExtractGuidedSectionGetInfo return 0 for
    ScratchBufferSize and ScratchBuffer will be NULL, after AllocatePool
    fails to allocate buffer for AllocatedOutputBuffer, the code will
    call FreePool (ScratchBuffer), but ScratchBuffer == NULL.
    
    This patch is to only free ScratchBuffer when it is not NULL.
    
    Cc: Liming Gao <liming.gao@intel.com>
    Contributed-under: TianoCore Contribution Agreement 1.0
    Signed-off-by: Star Zeng <star.zeng@intel.com>
    Reviewed-by: Liming Gao <liming.gao@intel.com>