nsIImageManager *manager; if ((result = NS_NewImageManager(&manager)) != NS_OK) { return result;
nsCOMPtr<nsIImageManager> manager; manager = do_GetService(kImageManagerCID, &result); if (NS_FAILED(result)) {  if ((result = NS_NewImageManager(getter_AddRefs(manager))) != NS_OK) { return result; }
NS_NewImageGroup(nsIImageGroup **aInstancePtrResult){  nsresult result;  NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");  if (nsnull == aInstancePtrResult) {    return NS_ERROR_NULL_POINTER;  }  nsIImageManager *manager;  if ((result = NS_NewImageManager(&manager)) != NS_OK) {      return result;  }  nsIImageGroup *group = new ImageGroupImpl(manager);  if (group == nsnull) {    return NS_ERROR_OUT_OF_MEMORY;  }  NS_RELEASE(manager);  return group->QueryInterface(kIImageGroupIID, (void **) aInstancePtrResult);}