This example shows how to free memory allocated by a ULS function.
#include <stdio.h> #include <unidef.h> int main(void) { LocaleObject locale_object = NULL; int rc = ULS_SUCCESS; char *locale_name; /* Create a locale object for French in Canada */ rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"fr_CA", &locale_object); if (rc != ULS_SUCCESS) { printf("UniCreateLocaleObject error: return code = %u\n", rc); return 1; } /* Determine the locale name for the LC_MESSAGES category */ rc = UniQueryLocaleObject(locale_object, LC_MESSAGES, UNI_MBS_STRING_POINTER, (void **)&locale_name); if (rc != ULS_SUCCESS) { printf("UniQueryLocaleObject error: return code = %u\n", rc); return 1; } /* Free the memory allocated by UniQueryLocaleObject */ rc = UniFreeMem((void **)locale_name); if (rc != ULS_SUCCESS) { printf("UniFreeMemObject error: return code = %u\n", rc); return 1; } return ULS_SUCCESS; }