]> git.ipfire.org Git - thirdparty/bacula.git/commit
Fix org#2665 About memory leak on FreeBSD with extended attributes
authorThomas Franz <franz@dssgmbh.de>
Mon, 19 Dec 2022 11:21:09 +0000 (12:21 +0100)
committerEric Bollengier <eric@baculasystems.com>
Mon, 19 Dec 2022 11:21:57 +0000 (12:21 +0100)
commit62f437b8bcb9aaf1cd1ef64e907c13a42bc0d803
tree9c3e8a181f83f48c23e12085f68e461983242441
parenta6341fdd23581072082c4b08c91cab51dbd34fa0
Fix org#2665 About memory leak on FreeBSD with extended attributes

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:".
bacula/src/filed/bxattr_freebsd.c