Change-Id: I8609072ca5a0eaf55c613390ece3d58b891e6d51
{
assert(path);
- const char *dest_file = get_temp_file_name();
+ char *dest_file = get_temp_file_name();
if (dest_file == NULL)
return -BR_ERR_INTERNAL;
if (copy_file(dest_file, path) == -1) {
_E("copy_file() error");
+ free(dest_file);
return -BR_ERR_INTERNAL;
}
int fd = open(dest_file, O_RDONLY);
if (fd == -1) {
_E("open() file: \"%s\" error: %m\n", path);
+ free(dest_file);
return -BR_ERR_INTERNAL;
}
+
unlink(dest_file);
+ free(dest_file);
return fd;
}