Test case 13.2

Examplethe Motif library. Motif is a legacy library, part of the X Window System; it was used (and perhaps still is) to develop GUIs for Unix (and Unix-like) systems.

For the purpose of this example, we will focus on one of its APIs: XmStringCreateLocalized(3). GUI developers use this function to create what Motif calls a "compound string"essentially, just a string that holds text in a specific locale (for the purposes of I18N-internationalization). This is its signature:

#include <Xm/Xm.h>
XmString XmStringCreateLocalized(char *text);

So, let's imagine the developer uses it to generate compound strings (for various purposes; very often, for the labels of a label or push button widget).

So, what's the problem? Leakage! How? ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.