added two api precondition guards use g_strdup with getenv to fix crash when using ENVVAR

Original commit message from CVS:
added two api precondition guards
use g_strdup with getenv to fix crash when using ENVVAR
This commit is contained in:
Stefan Kost 2004-11-01 11:45:26 +00:00
parent ea8e39aa43
commit cda239c8b4
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2004-11-01 Stefan Kost <ensonic@users.sf.net>
* ext/esd/esdsink.c: (gst_esdsink_init), (gst_esdsink_link):
added two api precondition guards
use g_strdup with getenv to fix crash when using ENVVAR
2004-11-01 Jan Schmidt <thaytan@mad.scientist.com>
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_finalize):

View file

@ -178,7 +178,7 @@ gst_esdsink_init (GTypeInstance * instance, gpointer g_class)
esdsink->channels = 2;
esdsink->frequency = 44100;
esdsink->bytes_per_sample = esdsink->channels * (esdsink->depth / 8);
esdsink->host = getenv ("ESPEAKER");
esdsink->host = g_strdup (getenv ("ESPEAKER"));
esdsink->provided_clock =
gst_audio_clock_new ("esdclock", gst_esdsink_get_time, esdsink);
gst_object_set_parent (GST_OBJECT (esdsink->provided_clock),
@ -205,6 +205,9 @@ gst_esdsink_link (GstPad * pad, const GstCaps * caps)
GstEsdsink *esdsink;
GstStructure *structure;
g_return_val_if_fail (caps != NULL, GST_PAD_LINK_REFUSED);
g_return_val_if_fail (pad != NULL, GST_PAD_LINK_REFUSED);
esdsink = GST_ESDSINK (gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0);