g_free(bin);
}
-
BT_HIDDEN
int bin_info_set_build_id(struct bin_info *bin, uint8_t *build_id,
size_t build_id_len)
dbg_dir = bin->debug_info_dir ? : DEFAULT_DEBUG_DIR;
- dir_name = dirname(bin->elf_path);
+ dir_name = g_path_get_dirname(bin->elf_path);
if (!dir_name) {
goto error;
}
/* bin_dir is just dir_name with a trailing slash */
- bin_dir = malloc(strlen(dir_name) + 2);
+ bin_dir = g_new0(char, strlen(dir_name) + 2);
if (!bin_dir) {
goto error;
}
max_path_len = strlen(dbg_dir) + strlen(bin_dir) +
strlen(DEBUG_SUBDIR) + strlen(bin->dbg_link_filename)
+ 1;
- path = malloc(max_path_len);
+ path = g_new0(char, max_path_len);
if (!path) {
goto error;
}
error:
ret = -1;
end:
- free(path);
- free(bin_dir);
+ g_free(dir_name);
+ g_free(path);
+ g_free(bin_dir);
return ret;