mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fixed strdup
This commit is contained in:
parent
82929cd852
commit
f563268fac
1 changed files with 5 additions and 2 deletions
|
|
@ -422,8 +422,9 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
|
|||
close(fd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
file->fname = strdup(fname);
|
||||
|
||||
if (fname)
|
||||
file->fname = strdup(fname);
|
||||
file->fd = fd;
|
||||
file->format = format;
|
||||
file->slave = slave;
|
||||
|
|
@ -431,6 +432,8 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
|
|||
|
||||
pcm = calloc(1, sizeof(snd_pcm_t));
|
||||
if (!pcm) {
|
||||
if (fname)
|
||||
free(file->fname);
|
||||
free(file);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue