libei: fix the source ref handling

Plugs a memleak in libeis where we don't care about the return value of the
source_add_autoclose().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-06 15:16:39 +10:00
parent ba9b0bb903
commit 42546acf3f
2 changed files with 3 additions and 2 deletions

View file

@ -703,7 +703,8 @@ error:
int
ei_set_connection(struct ei *ei, int fd)
{
ei->source = source_add_autoclose(ei->sink, fd, connection_dispatch, ei);
struct source *source = source_add_autoclose(ei->sink, fd, connection_dispatch, ei);
ei->source = source_ref(source);
if (!ei->source)
return -ENOMEM;

View file

@ -118,7 +118,7 @@ source_add(struct sink *sink, int sourcefd,
list_append(&sink->sources, &source->link);
return source_ref(source);
return source;
}
struct source *