Skip to content
  • thomas_franz's avatar
    Fix org#2665 About memory leak on FreeBSD with extended attributes · 62f437b8
    thomas_franz authored and Eric Bollengier's avatar Eric Bollengier committed
    Extended attributes in FreeBSD exists for attrnamespace "user" and
    "system". Bacula saves this data serializing extended attributes for every
    file.
    
    In the source bxattr_freebsd.c of bacula 13.0.1 the following problems could be
    identified:
    
     - Bug missing data during backup: If a file has extended attributes of type
       "system" but not of type "user" then these are missing in the serializing
       stream for the backup. This is caused by the return statement when no
       extended attribute of type "user" exists.
    
     - Memory leak when using extattr_namespace_to_string() because this function
       calls strdup() and does never free the memory allocated by strdup(). This
       problem did not exists until Bacula 7.4.4, but the correct handling was
       dropped in Bacula 7.4.5.
    
     - Memory leak during backup of files having extended attributes of both types
       "user" and "system". In this case the pointer "xlist" is used first for
       "user" and then for "system". The space allocated for "user" remains
       allocated.
    
     - Memory leak during backup of files having extended attributes of type "user"
       but not of type "system". In this case a return statetement is done for type
       "system" and the allocated memory for "user" cannot be freed in the coding
       after "bail_out:".
    62f437b8