• D
    Fix leak in qemuStringToArgvEnv upon OOM · b391b191
    Daniel P. Berrange 提交于
    The 'qemuStringToArgvEnv' method splits up a string of command
    line env/args to an 'arglist' array. It then copies env vars
    to a 'progenv' array and args to a 'progargv' array. When
    copyin the env vars, it NULL-ifies the element in 'arglist'
    that is copied.
    
    Upon OOM the 'virStringListFree' is called on progenv and
    arglist. Unfortunately, because the elements in 'arglist'
    related to env vars have been set to NULL, the call to
    virStringListFree(arglist) doesn't free anything, even
    though some non-NULL args vars still exist later in the
    array.
    
    To fix this leak, stop NULL-ifying the 'arglist' elements,
    and change the cleanup code to only free elements in the
    'arglist' array, not 'progenv'.
    Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
    b391b191
qemu_command.c 416.8 KB