539513e OvmfPkg: QemuVideoDxe: tidy up error checking/handling in & under Start()

Authored and Committed by lersek 10 years ago
    OvmfPkg: QemuVideoDxe: tidy up error checking/handling in & under Start()
    
    In QemuVideoControllerDriverStart():
    - remove redundant zero-initialization of:
      - Private->Handle (2 locations)
      - Private->GopDevicePath (when at devpath end)
    
    - remove fields used for error handling only:
      - PciAttributesSaved
    
    - tigthen scope of temporaries:
      - MmioDesc
      - AcpiDeviceNode
    
    - supplement missing error checks:
      - AppendDevicePathNode() can fail with out-of-memory (2 locations)
      - when installing GopDevicePath
      - retval of QemuVideoGraphicsOutputConstructor() (can justifiedly fail
        with out-of-resources)
    
    - plug leaks on error:
      - free GopDevicePath (AppendDevicePathNode() allocates dynamically)
      - uninstall GopDevicePath
      - free Private->ModeData
      - call QemuVideoGraphicsOutputDestructor()
      - uninstall GOP
    
    In QemuVideoGraphicsOutputConstructor(), called by Start():
    - supplement missing error checks:
      - QemuVideoGraphicsOutputSetMode() retval (it can fail with
        out-of-resources)
    
    - plug leaks on error:
      - free Mode->Info
      - free Mode
    
    In QemuVideoCirrusModeSetup() and QemuVideoBochsModeSetup(), both called
    by Start():
    - supplement missing error checks:
      - AllocatePool() can fail in both
    
    In QemuVideoGraphicsOutputDestructor(), called by Start() on the error
    path:
    - plug leaks:
      - free Private->LineBuffer, which is allocated in
        Start() -> Constructor() -> SetMode()
    
    In QemuVideoGraphicsOutputSetMode(), called by Start() indirectly:
    - remove redundant zero-assignment to:
      - Private->LineBuffer
    
    Contributed-under: TianoCore Contribution Agreement 1.0
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
    Signed-off-by: Laszlo Ersek <lersek@redhat.com>
    
        
file modified
+103 -92
file modified
+20 -3