• Jesper Juhl's avatar
    iscsi-target: Fix leak on failure in iscsi_copy_param_list() · 9be08c58
    Jesper Juhl authored
    We leak memory if the allocations for 'new_param->name' or
    'new_param->value' fail in iscsi_target_parameters.c::iscsi_copy_param_list()
    
    We also do a lot of variable assignments that are completely pointless
    if the allocations fail.
    
    So, let's move the allocations before the assignments and also make
    sure that we free whatever was allocated to one if the allocation fail.
    
    There's also some small CodingStyle fixups in there (curly braces on
    both branches of if statement, only one variable per line) since I was
    in the area anyway. And finally, error messages in the function are
    put on a single line for easy grep'abillity.
    Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    9be08c58
iscsi_target_parameters.c 51.3 KB