We can simply fix this issue by switching to our cleanup macros instead of
manually freeing the memory.
Closes #2912.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
#include "btrfs.h"
#include "config.h"
#include "log.h"
+#include "memory_utils.h"
#include "rsync.h"
#include "storage.h"
#include "utils.h"
int ret, e, i;
unsigned long off = 0;
u16 name_len;
- char *tmppath;
u64 dir_id;
fd = open(path, O_RDONLY);
* name of the child subvol in question.
*/
if (sh.objectid != root_id && sh.type == BTRFS_ROOT_BACKREF_KEY) {
- char *name, *tmp;
+ __do_free char *name = NULL, *tmppath = NULL;
+ char *tmp;
ref = (struct btrfs_root_ref *)(args.buf + off);
name_len = btrfs_stack_root_ref_name_len(ref);
if (!name) {
ERROR("Out of memory");
free_btrfs_tree(tree);
- free(tmppath);
close(fd);
}
name_len, tmppath)) {
ERROR("Out of memory");
free_btrfs_tree(tree);
- free(name);
- free(tmppath);
close(fd);
return -1;
}
-
- free(tmppath);
- free(name);
}
off += sh.len;