On 27.10.2014 23:12, Lukasz Marek wrote:
On 26.10.2014 23:27, Michael Niedermayer wrote:
+/* ported from alsa-utils/aplay.c */
+int ff_alsa_get_device_list(AVDeviceInfoList *device_list,
snd_pcm_stream_t stream_type)
+{
+ int ret = 0;
+ void **hints, **n;
+ char *name = NULL, *descr = NULL, *io = NULL, *tmp;
+ AVDeviceInfo *new_device = NULL;
+ const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ?
"Output" : "Input";
+
+ if (snd_device_name_hint(-1, "pcm", &hints) < 0)
+ return AVERROR_EXTERNAL;
+ n = hints;
+ while (*n) {
+ tmp = snd_device_name_get_hint(*n, "NAME");
+ name = av_strdup(tmp);
+ if (tmp && !name) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ free(tmp);
+ tmp = snd_device_name_get_hint(*n, "DESC");
+ descr = av_strdup(tmp);
+ if (tmp && !descr) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ free(tmp);
+ tmp = snd_device_name_get_hint(*n, "IOID");
+ io = av_strdup(tmp);
+ if (tmp && !io) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ free(tmp);
doesnt mem leak in case of the goto fails ?
i dont see where its freed
I intended to free before ifs, but I'm a victim of routine...
I noticed it can be done more clever anyway, so one more patch attached.
Pushed.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel