aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-01-15 16:30:43 -0800
committerChris Robinson <[email protected]>2008-01-15 16:30:43 -0800
commita11f25e47b36364aa3e284640ee8f15aaa266de8 (patch)
treebdd16ec6c5272467a1a4f93057166b3c558195b1 /OpenAL32/alSource.c
parenta6213ebfc75da6428849083d57e57dec3f8670a3 (diff)
Fix source and buffer out-of-memory conditions
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 746ec821..4cafe190 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -65,22 +65,22 @@ ALAPI ALvoid ALAPIENTRY alGenSources(ALsizei n,ALuint *sources)
while(i < n)
{
*list = calloc(1, sizeof(ALsource));
- if(*list)
+ if(!(*list))
{
- sources[i]=(ALuint)ALTHUNK_ADDENTRY(*list);
- (*list)->source = sources[i];
+ alDeleteSources(i, sources);
+ alSetError(AL_OUT_OF_MEMORY);
+ break;
+ }
- InitSourceParams(*list);
- Context->SourceCount++;
- i++;
+ sources[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
+ (*list)->source = sources[i];
- list = &(*list)->next;
- }
- }
+ InitSourceParams(*list);
+ Context->SourceCount++;
+ i++;
- // If we didn't create all the Sources, we must have run out or memory
- if(i != n)
- alSetError(AL_OUT_OF_MEMORY);
+ list = &(*list)->next;
+ }
}
else
{