@@ -203,6 +203,7 @@ static int wait_for_stdin(void)
203
203
if (interrupted) raise(SIGINT);
204
204
}
205
205
CFReadStreamClose(stream);
206
+ CFRelease(stream);
206
207
return 1;
207
208
}
208
209
@@ -2103,6 +2104,7 @@ static int _find_maximum(CGFloat values[3])
2103
2104
function,
2104
2105
true,
2105
2106
true);
2107
+ CGColorSpaceRelease(colorspace);
2106
2108
CGFunctionRelease(function);
2107
2109
if (shading)
2108
2110
{
@@ -2236,6 +2238,7 @@ static CGRect _find_enclosing_rect(CGPoint points[3])
2236
2238
CGImageRef mask = CGBitmapContextCreateImage(bitmap);
2237
2239
CGContextClipToMask(cr, rect, mask);
2238
2240
CGImageRelease(mask);
2241
+ CGContextRelease(bitmap);
2239
2242
free(data);
2240
2243
return 0;
2241
2244
}
@@ -3990,9 +3993,9 @@ static void _data_provider_release(void* info, const void* data, size_t size)
3990
3993
if(window)
3991
3994
{
3992
3995
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
3993
- NSString* ns_title = [[NSString alloc]
3994
- initWithCString: title
3995
- encoding: NSUTF8StringEncoding];
3996
+ NSString* ns_title = [[[ NSString alloc]
3997
+ initWithCString: title
3998
+ encoding: NSUTF8StringEncoding] autorelease ];
3996
3999
[window setTitle: ns_title];
3997
4000
[pool release];
3998
4001
}
@@ -4489,7 +4492,12 @@ -(void)save_figure:(id)sender
4489
4492
NSMenu* menu = [button menu];
4490
4493
NSArray* items = [menu itemArray];
4491
4494
unsigned int n = [items count];
4492
- int* states = malloc(n*sizeof(int));
4495
+ int* states = calloc(n, sizeof(int));
4496
+ if (!states)
4497
+ {
4498
+ PyErr_SetString(PyExc_RuntimeError, "calloc failed");
4499
+ return NULL;
4500
+ }
4493
4501
int i;
4494
4502
unsigned int m = 0;
4495
4503
NSEnumerator* enumerator = [items objectEnumerator];
@@ -4504,7 +4512,6 @@ -(void)save_figure:(id)sender
4504
4512
states[i] = 1;
4505
4513
m++;
4506
4514
}
4507
- else states[i] = 0;
4508
4515
}
4509
4516
int j = 0;
4510
4517
PyObject* list = PyList_New(m);
0 commit comments