Kaydet (Commit) 38a22bae authored tarafından Sjoerd Mullender's avatar Sjoerd Mullender

Fixed some memory leaks when things go wrong.

üst 55cea47b
......@@ -731,11 +731,6 @@ audioop_lin2adpcm3(self, args)
return 0;
}
str = newsizedstringobject(NULL, len/size);
if ( str == 0 )
return 0;
ncp = (signed char *)getstringvalue(str);
/* Decode state, should have (value, step) */
if ( state == None ) {
/* First time, it seems. Set defaults */
......@@ -744,6 +739,11 @@ audioop_lin2adpcm3(self, args)
} else if ( !getargs(state, "(ii)", &valprev, &step) )
return 0;
str = newsizedstringobject(NULL, len/size);
if ( str == 0 )
return 0;
ncp = (signed char *)getstringvalue(str);
for ( i=0; i < len; i += size ) {
if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8;
else if ( size == 2 ) val = (int)*SHORTP(cp, i);
......@@ -861,11 +861,6 @@ audioop_lin2adpcm(self, args)
return 0;
}
str = newsizedstringobject(NULL, len/(size*2));
if ( str == 0 )
return 0;
ncp = (signed char *)getstringvalue(str);
/* Decode state, should have (value, step) */
if ( state == None ) {
/* First time, it seems. Set defaults */
......@@ -875,6 +870,11 @@ audioop_lin2adpcm(self, args)
} else if ( !getargs(state, "(ii)", &valpred, &index) )
return 0;
str = newsizedstringobject(NULL, len/(size*2));
if ( str == 0 )
return 0;
ncp = (signed char *)getstringvalue(str);
step = stepsizeTable[index];
bufferstep = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment