summaryrefslogtreecommitdiffstats
path: root/ext/alsaspdif
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-11-29 10:44:54 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-11-29 10:44:54 +0000
commite8af48c02bbfe197d10386aa4b413c9d64bb6fc9 (patch)
treea4d5f5ba91cd73b4cdf0943167cdf175a30718b7 /ext/alsaspdif
parent14da2ceef57b29bafd0cb9ba0d37ebd5c1571587 (diff)
downloadgst-plugins-bad-e8af48c02bbfe197d10386aa4b413c9d64bb6fc9.tar.gz
gst-plugins-bad-e8af48c02bbfe197d10386aa4b413c9d64bb6fc9.tar.bz2
gst-plugins-bad-e8af48c02bbfe197d10386aa4b413c9d64bb6fc9.zip
ext/alsaspdif/alsaspdifsink.c: Don't free uninitialized data when we are in error.
Original commit message from CVS: * ext/alsaspdif/alsaspdifsink.c: (alsaspdifsink_set_caps), (alsaspdifsink_get_time), (alsaspdifsink_set_params), (alsaspdifsink_find_pcm_device): Don't free uninitialized data when we are in error.
Diffstat (limited to 'ext/alsaspdif')
-rw-r--r--ext/alsaspdif/alsaspdifsink.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/ext/alsaspdif/alsaspdifsink.c b/ext/alsaspdif/alsaspdifsink.c
index 15248614..18c26ab9 100644
--- a/ext/alsaspdif/alsaspdifsink.c
+++ b/ext/alsaspdif/alsaspdifsink.c
@@ -475,11 +475,11 @@ alsaspdifsink_find_pcm_device (AlsaSPDIFSink * sink)
int card = sink->card;
gchar pcm_name[24];
snd_pcm_t *pcm = NULL;
- snd_ctl_t *ctl;
- snd_ctl_card_info_t *info;
- snd_ctl_elem_list_t *clist;
- snd_ctl_elem_id_t *cid;
- snd_pcm_info_t *pinfo;
+ snd_ctl_t *ctl = NULL;
+ snd_ctl_card_info_t *info = NULL;
+ snd_ctl_elem_list_t *clist = NULL;
+ snd_ctl_elem_id_t *cid = NULL;
+ snd_pcm_info_t *pinfo = NULL;
GST_WARNING ("Opening IEC958 named device failed. Trying to autodetect");
@@ -585,12 +585,18 @@ alsaspdifsink_find_pcm_device (AlsaSPDIFSink * sink)
beach:
if (pcm)
snd_pcm_close (pcm);
- snd_ctl_elem_list_clear (clist);
- snd_ctl_close (ctl);
- snd_ctl_elem_list_free (clist);
- snd_ctl_elem_id_free (cid);
- snd_ctl_card_info_free (info);
- snd_pcm_info_free (pinfo);
+ if (clist)
+ snd_ctl_elem_list_clear (clist);
+ if (ctl)
+ snd_ctl_close (ctl);
+ if (clist)
+ snd_ctl_elem_list_free (clist);
+ if (cid)
+ snd_ctl_elem_id_free (cid);
+ if (info)
+ snd_ctl_card_info_free (info);
+ if (pinfo)
+ snd_pcm_info_free (pinfo);
return err;
}