move CFRelease(imagePropertiesDictionary); inside if statement