summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodor Tomov <ttomov@mm-sol.com>2011-01-04 11:49:56 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-01-04 23:28:15 +0100
commit5e883a1186481eb29d947d1453916c702b6bcd92 (patch)
treec07727c6cf4a62fce48df76bb50d2b032dc3578d
parent6971cf795cfefed91bba87c76eee0e8a28d22b7c (diff)
media.c: fix NULL pointer dereference in media_enum_links()
Do not dereference source and sink in media_enum_links() if one of them is NULL. Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
-rw-r--r--media.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/media.c b/media.c
index 75ca24c..d5d98de 100644
--- a/media.c
+++ b/media.c
@@ -424,11 +424,11 @@ static int media_enum_links(struct media_device *media)
id, i, link->source.entity, link->source.index,
link->sink.entity, link->sink.index);
ret = -EINVAL;
+ } else {
+ entity->links[i].source = &source->pads[link->source.index];
+ entity->links[i].sink = &sink->pads[link->sink.index];
+ entity->links[i].flags = links.links[i].flags;
}
-
- entity->links[i].source = &source->pads[link->source.index];
- entity->links[i].sink = &sink->pads[link->sink.index];
- entity->links[i].flags = links.links[i].flags;
}
free(links.pads);