Skip to content

Commit c1a9a27

Browse files
robert-ancellardera
authored andcommitted
Fix compile warning about not checking result of asprintf
1 parent af8c8d6 commit c1a9a27

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/plugins/audioplayers/player.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static void audio_player_source_setup(GstElement *playbin, GstElement *source, G
8282
struct audio_player *audio_player_new(char *player_id, char *channel) {
8383
GPollFD fd;
8484
sd_event_source *busfd_event_source;
85+
int ok;
8586

8687
struct audio_player *self = malloc(sizeof(struct audio_player));
8788
if (self == NULL) {
@@ -144,10 +145,10 @@ struct audio_player *audio_player_new(char *player_id, char *channel) {
144145

145146
// audioplayers player event channel clang:
146147
// <local>/events/<player_id>
147-
asprintf(&self->event_channel_name, "%s/events/%s", channel, player_id);
148-
ASSERT_MSG(self->event_channel_name != NULL, "event channel name OEM");
148+
ok = asprintf(&self->event_channel_name, "%s/events/%s", channel, player_id);
149+
ASSERT_MSG(ok, "event channel name OEM");
149150

150-
if (self->event_channel_name == NULL) {
151+
if (ok < 0) {
151152
goto deinit_player_id;
152153
}
153154

0 commit comments

Comments
 (0)