Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions base.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ int uio_get_fd(struct uio_info_t* info)
*/
void uio_free_info(struct uio_info_t* info)
{
int i;

if (info)
{
if (info->path)
Expand All @@ -187,7 +189,14 @@ void uio_free_info(struct uio_info_t* info)
if (info->version)
free (info->version);
if (info->maps)
{
for (i = 0; i < info->maxmap; i++)
{
if (info->maps[i].name)
free(info->maps[i].name);
}
free (info->maps);
}
if (info->devname)
free (info->devname);
free (info);
Expand Down Expand Up @@ -261,11 +270,14 @@ struct uio_info_t *uio_find_by_uio_name (char *uio_name)

name = uio_get_name (candidate);

if (!strcmp (name, uio_name)) {
if ((!info) && (!strcmp (name, uio_name))) {
info = candidate;
break;
}
else
uio_free_info(candidate);

}

free (uio_list);

return info;
Expand Down Expand Up @@ -451,6 +463,8 @@ int uio_close (struct uio_info_t* info)

close (info->fd);

uio_free_info(info);

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions libuio.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct uio_info_t **uio_find_devices ();
struct uio_info_t *uio_find_by_uio_name (char *uio_name);
struct uio_info_t *uio_find_by_uio_num (int num);
struct uio_info_t *uio_find_by_base_addr (unsigned int base_addr);
void uio_free_info(struct uio_info_t* info);
void uio_setsysfs_point (const char *sysfs_mpoint);
char *uio_get_name (struct uio_info_t* info);
char *uio_get_version (struct uio_info_t* info);
Expand Down