On May 10, 2011, at 02:46:06, ahihi wrote:
> +                free(lValue);
>                               CFDictionarySetValue(note, convertedKey, 
> convertedValue);
>                               CFRelease(convertedValue);
>                       } else {
> +                free(lValue);
>                               CFRelease(convertedKey);
>                               PyErr_SetString(PyExc_TypeError, "Icon with 
> rawImageData
> attribute present must ensure it is a string.");
>                               goto error;
> 
> I don't have much C experience beyond a university class I took, so I
> don't know if this is idiomatic code in the OS X environment, …

Nothing from OS X or C makes this invalid, but I think it's wrong in Python 
library terms.

Because lValue is a PyObject (specifically, a PyString), created using a Python 
library function, it must be released using Py_DECREF. (The analogy in Cocoa 
would be [lValue release], and in Core Foundation would be CFRelease(lValue).) 
Freeing the object will probably work, but won't free anything the object owns, 
such as a backing buffer.

I think you have the right idea; you just used the wrong callable. I'll commit 
it with free replaced with Py_DECREF; this and the other patch will be in 
1.2.2b2, which I'll release afterward.

-- 
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en.

Reply via email to