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
14 changes: 10 additions & 4 deletions base.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,14 @@ void uio_free_info(struct uio_info_t* info)
free (info->name);
if (info->version)
free (info->version);
if (info->maps)
free (info->maps);
if (info->maps) {
for (int 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 @@ -216,7 +222,6 @@ struct uio_info_t **uio_find_devices ()
info = calloc (nr, sizeof (struct uio_info_t *));
if (!info)
{
errno = ENOMEM;
g_warning (_("calloc: %s\n"), g_strerror (errno));
goto out;
}
Expand Down Expand Up @@ -263,7 +268,8 @@ struct uio_info_t *uio_find_by_uio_name (char *uio_name)

if (!strcmp (name, uio_name)) {
info = candidate;
break;
} else {
uio_free_info(candidate);
}
}
free (uio_list);
Expand Down
4 changes: 3 additions & 1 deletion helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,10 @@ struct uio_info_t *create_uio_info (char *dir, char *name)
char filename [PATH_MAX];

info = calloc (1, sizeof (struct uio_info_t));
if (!info)
if (!info) {
g_warning (_("calloc: %s\n"), g_strerror (errno));
return NULL;
}

snprintf (filename, PATH_MAX, "%s/%s", dir, name);
info->path = strdup (filename);
Expand Down
1 change: 1 addition & 0 deletions libuio.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
struct uio_info_t;

/* base functions */
void uio_free_info(struct uio_info_t* info);
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);
Expand Down