ALSA: xen-front: freeing an error pointer
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 30 May 2018 10:36:55 +0000 (13:36 +0300)
committerTakashi Iwai <tiwai@suse.de>
Wed, 30 May 2018 11:19:45 +0000 (13:19 +0200)
kfree() doesn't accept error pointers so I've set "str" to NULL on these
paths.

Fixes: fd3b36045c2c ("ALSA: xen-front: Read sound driver configuration from Xen store")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/xen/xen_snd_front_cfg.c

index 684b5f1d51aca2fb7ce7112849320af31cdcdea7..eda077c8087a87304f9b3d9a80bc21ee7fd13efd 100644 (file)
@@ -306,6 +306,7 @@ static int cfg_get_stream_type(const char *path, int index,
        str = xenbus_read(XBT_NIL, stream_path, XENSND_FIELD_TYPE, NULL);
        if (IS_ERR(str)) {
                ret = PTR_ERR(str);
+               str = NULL;
                goto fail;
        }
 
@@ -347,6 +348,7 @@ static int cfg_stream(struct xen_snd_front_info *front_info,
        str = xenbus_read(XBT_NIL, stream_path, XENSND_FIELD_TYPE, NULL);
        if (IS_ERR(str)) {
                ret = PTR_ERR(str);
+               str = NULL;
                goto fail;
        }