Merge remote branch 'dottedmag/for-keithp'

This commit is contained in:
Keith Packard 2010-06-11 10:08:13 -07:00
commit a41d6e9bff
30 changed files with 119 additions and 151 deletions

View File

@ -133,7 +133,7 @@ add_option(InputOption **options, const char *key, const char *value)
*options = calloc(sizeof(**options), 1); *options = calloc(sizeof(**options), 1);
if (!*options) /* Yeesh. */ if (!*options) /* Yeesh. */
return; return;
(*options)->key = xstrdup(key); (*options)->key = strdup(key);
(*options)->value = xstrdup(value); (*options)->value = strdup(value);
(*options)->next = NULL; (*options)->next = NULL;
} }

View File

@ -86,8 +86,8 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
return BadAlloc; return BadAlloc;
} }
options->key = xstrdup("_source"); options->key = strdup("_source");
options->value = xstrdup("client/dbus"); options->value = strdup("client/dbus");
if (!options->key || !options->value) { if (!options->key || !options->value) {
ErrorF("[config/dbus] couldn't allocate first key/value pair\n"); ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
ret = BadAlloc; ret = BadAlloc;
@ -120,7 +120,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
tmp); tmp);
MALFORMED_MESSAGE(); MALFORMED_MESSAGE();
} }
options->key = xstrdup(tmp); options->key = strdup(tmp);
if (!options->key) { if (!options->key) {
ErrorF("[config/dbus] couldn't duplicate key!\n"); ErrorF("[config/dbus] couldn't duplicate key!\n");
ret = BadAlloc; ret = BadAlloc;
@ -136,7 +136,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
dbus_message_iter_get_basic(&subiter, &tmp); dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp) if (!tmp)
MALFORMED_MESSAGE(); MALFORMED_MESSAGE();
options->value = xstrdup(tmp); options->value = strdup(tmp);
if (!options->value) { if (!options->value) {
ErrorF("[config/dbus] couldn't duplicate option!\n"); ErrorF("[config/dbus] couldn't duplicate option!\n");
ret = BadAlloc; ret = BadAlloc;

View File

@ -81,7 +81,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL); prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)"); LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)");
if (prop) { if (prop) {
ret = xstrdup(prop); ret = strdup(prop);
libhal_free_string(prop); libhal_free_string(prop);
} }
else { else {
@ -156,13 +156,13 @@ device_added(LibHalContext *hal_ctx, const char *udi)
LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi); LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
goto unwind; goto unwind;
} }
attrs.device = xstrdup(path); attrs.device = strdup(path);
name = get_prop_string(hal_ctx, udi, "info.product"); name = get_prop_string(hal_ctx, udi, "info.product");
if (!name) if (!name)
name = xstrdup("(unnamed)"); name = strdup("(unnamed)");
else else
attrs.product = xstrdup(name); attrs.product = strdup(name);
attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor"); attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor");
hal_tags = get_prop_string(hal_ctx, udi, "input.tags"); hal_tags = get_prop_string(hal_ctx, udi, "input.tags");
@ -211,8 +211,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
goto unwind; goto unwind;
} }
options->key = xstrdup("_source"); options->key = strdup("_source");
options->value = xstrdup("server/hal"); options->value = strdup("server/hal");
if (!options->key || !options->value) { if (!options->key || !options->value) {
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n"); LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
goto unwind; goto unwind;
@ -387,7 +387,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
for (; dev; dev = dev->next){ for (; dev; dev = dev->next){
free(dev->config_info); free(dev->config_info);
dev->config_info = xstrdup(config_info); dev->config_info = strdup(config_info);
} }
unwind: unwind:

View File

@ -86,8 +86,8 @@ device_added(struct udev_device *udev_device)
if (!options) if (!options)
return; return;
options->key = xstrdup("_source"); options->key = strdup("_source");
options->value = xstrdup("server/udev"); options->value = strdup("server/udev");
if (!options->key || !options->value) if (!options->key || !options->value)
goto unwind; goto unwind;
@ -197,7 +197,7 @@ device_added(struct udev_device *udev_device)
for (; dev; dev = dev->next) { for (; dev; dev = dev->next) {
free(dev->config_info); free(dev->config_info);
dev->config_info = xstrdup(config_info); dev->config_info = strdup(config_info);
} }
unwind: unwind:

View File

@ -1836,7 +1836,7 @@ SetDefaultFontPath(char *path)
if (!start) { if (!start) {
temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : ""); temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
} else { } else {
temp_path = xstrdup(path); temp_path = strdup(path);
} }
if (!temp_path) if (!temp_path)
return BadAlloc; return BadAlloc;

View File

@ -127,15 +127,11 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = NULL; cache->picture = NULL;
} }
if (cache->hashEntries) { free(cache->hashEntries);
free(cache->hashEntries); cache->hashEntries = NULL;
cache->hashEntries = NULL;
}
if (cache->glyphs) { free(cache->glyphs);
free(cache->glyphs); cache->glyphs = NULL;
cache->glyphs = NULL;
}
cache->glyphCount = 0; cache->glyphCount = 0;
} }
} }

View File

@ -2433,7 +2433,7 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientminorVersion = req->minor; cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions); free(cl->GLClientextensions);
buf = (const char *)(req+1); buf = (const char *)(req+1);
cl->GLClientextensions = xstrdup(buf); cl->GLClientextensions = strdup(buf);
return Success; return Success;
} }

View File

@ -356,9 +356,9 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
return; return;
pGlxScreen->pScreen = pScreen; pGlxScreen->pScreen = pScreen;
pGlxScreen->GLextensions = xstrdup(GLServerExtensions); pGlxScreen->GLextensions = strdup(GLServerExtensions);
pGlxScreen->GLXvendor = xstrdup(GLXServerVendorName); pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
pGlxScreen->GLXextensions = xstrdup(GLXServerExtensions); pGlxScreen->GLXextensions = strdup(GLXServerExtensions);
/* All GLX providers must support all of the functionality required for at /* All GLX providers must support all of the functionality required for at
* least GLX 1.2. If the provider supports a higher version, the GLXminor * least GLX 1.2. If the provider supports a higher version, the GLXminor

View File

@ -885,7 +885,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
&& dmxL->deviceId < 0) { && dmxL->deviceId < 0) {
dmxL->deviceId = devices[i].id; dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name dmxL->deviceName = (devices[i].name
? xstrdup(devices[i].name) ? strdup(devices[i].name)
: NULL); : NULL);
} }
} }
@ -918,7 +918,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
dmxLocal->sendsCore = FALSE; dmxLocal->sendsCore = FALSE;
dmxLocal->deviceId = devices[i].id; dmxLocal->deviceId = devices[i].id;
dmxLocal->deviceName = (devices[i].name dmxLocal->deviceName = (devices[i].name
? xstrdup(devices[i].name) ? strdup(devices[i].name)
: NULL); : NULL);
} }
} }

View File

@ -439,6 +439,6 @@ void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
kbdUSBGetMap(pDev, &info->keySyms, info->modMap); kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
info->focusClass = 1; info->focusClass = 1;
info->kbdFeedbackClass = 1; info->kbdFeedbackClass = 1;
info->names.keycodes = xstrdup("powerpcps2"); info->names.keycodes = strdup("powerpcps2");
info->force = 1; info->force = 1;
} }

View File

@ -831,10 +831,8 @@ out:
XFreeGC (dpy, gc) ; XFreeGC (dpy, gc) ;
gc = NULL ; gc = NULL ;
} }
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok ; return is_ok ;
} }

View File

@ -669,11 +669,8 @@ hostx_screen_init (EphyrScreenInfo screen,
} }
else else
{ {
if (host_screen->ximg->data) free(host_screen->ximg->data);
{ host_screen->ximg->data = NULL;
free(host_screen->ximg->data);
host_screen->ximg->data = NULL;
}
XDestroyImage(host_screen->ximg); XDestroyImage(host_screen->ximg);
} }
@ -1160,10 +1157,8 @@ out:
XFree (visuals) ; XFree (visuals) ;
visuals = NULL; visuals = NULL;
} }
if (host_visuals) { free(host_visuals);
free (host_visuals) ; host_visuals = NULL;
host_visuals = NULL;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok ; return is_ok ;
@ -1292,10 +1287,8 @@ hostx_set_window_bounding_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ; rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ; is_ok = TRUE ;
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok; return is_ok;
} }
@ -1329,10 +1322,8 @@ hostx_set_window_clipping_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ; rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ; is_ok = TRUE ;
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok; return is_ok;
} }

View File

@ -919,7 +919,7 @@ KdAddConfigKeyboard (char *keyboard)
if (!new) if (!new)
return BadAlloc; return BadAlloc;
new->line = xstrdup(keyboard); new->line = strdup(keyboard);
new->next = NULL; new->next = NULL;
for (prev = &kdConfigKeyboards; *prev; prev = &(*prev)->next); for (prev = &kdConfigKeyboards; *prev; prev = &(*prev)->next);
@ -987,7 +987,7 @@ KdAddConfigPointer (char *pointer)
if (!new) if (!new)
return BadAlloc; return BadAlloc;
new->line = xstrdup(pointer); new->line = strdup(pointer);
new->next = NULL; new->next = NULL;
for (prev = &kdConfigPointers; *prev; prev = &(*prev)->next); for (prev = &kdConfigPointers; *prev; prev = &(*prev)->next);
@ -1067,11 +1067,11 @@ KdGetOptions (InputOption **options, char *string)
newopt->key = (char *)malloc(tam_key); newopt->key = (char *)malloc(tam_key);
strncpy(newopt->key, string, tam_key); strncpy(newopt->key, string, tam_key);
newopt->key[tam_key] = '\0'; newopt->key[tam_key] = '\0';
newopt->value = xstrdup(strchr(string, '=') + 1); newopt->value = strdup(strchr(string, '=') + 1);
} }
else else
{ {
newopt->key = xstrdup(string); newopt->key = strdup(string);
newopt->value = NULL; newopt->value = NULL;
} }
newopt->next = NULL; newopt->next = NULL;
@ -1147,7 +1147,7 @@ KdParseKeyboard (char *arg)
if (strcmp (save, "auto") == 0) if (strcmp (save, "auto") == 0)
ki->driverPrivate = NULL; ki->driverPrivate = NULL;
else else
ki->driverPrivate = xstrdup(save); ki->driverPrivate = strdup(save);
if (delim != ',') if (delim != ',')
{ {
@ -1243,7 +1243,7 @@ KdParsePointer (char *arg)
if (strcmp(save, "auto") == 0) if (strcmp(save, "auto") == 0)
pi->driverPrivate = NULL; pi->driverPrivate = NULL;
else else
pi->driverPrivate = xstrdup(save); pi->driverPrivate = strdup(save);
if (delim != ',') if (delim != ',')
{ {

View File

@ -277,16 +277,16 @@ configureInputSection (void)
mouse->inp_identifier = "Mouse0"; mouse->inp_identifier = "Mouse0";
mouse->inp_driver = "mouse"; mouse->inp_driver = "mouse";
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"), xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
xstrdup(DFLT_MOUSE_PROTO)); strdup(DFLT_MOUSE_PROTO));
#ifndef __SCO__ #ifndef __SCO__
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"), xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
xstrdup(DFLT_MOUSE_DEV)); strdup(DFLT_MOUSE_DEV));
#endif #endif
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"), xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
xstrdup("4 5 6 7")); strdup("4 5 6 7"));
ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
return ptr; return ptr;
} }
@ -389,7 +389,7 @@ configureDeviceSection (int screennum)
" ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
" ### <percent>: \"<f>%\"\n" " ### <percent>: \"<f>%\"\n"
" ### [arg]: arg optional\n"; " ### [arg]: arg optional\n";
ptr->dev_comment = xstrdup(descrip); ptr->dev_comment = strdup(descrip);
if (ptr->dev_comment) { if (ptr->dev_comment) {
for (p = DevToConfig[screennum].GDev.options; for (p = DevToConfig[screennum].GDev.options;
p->name != NULL; p++) { p->name != NULL; p++) {
@ -440,7 +440,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL; iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Mouse0"; iptr->iref_inputdev_str = "Mouse0";
iptr->iref_option_lst = iptr->iref_option_lst =
xf86addNewOption (iptr->iref_option_lst, xstrdup("CorePointer"), NULL); xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr) ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
} }
@ -453,7 +453,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL; iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Keyboard0"; iptr->iref_inputdev_str = "Keyboard0";
iptr->iref_option_lst = iptr->iref_option_lst =
xf86addNewOption (iptr->iref_option_lst, xstrdup("CoreKeyboard"), NULL); xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr) ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
} }
@ -626,7 +626,7 @@ configureDDCMonitorSection (int screennum)
ptr); ptr);
if (ConfiguredMonitor->features.dpms) { if (ConfiguredMonitor->features.dpms) {
ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xstrdup("DPMS"), NULL); ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
} }
return ptr; return ptr;

View File

@ -209,7 +209,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
if (ParseOptionValue(-1, optlist, &o, markUsed)) if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.str; deflt = o.value.str;
if (deflt) if (deflt)
return xstrdup(deflt); return strdup(deflt);
else else
return NULL; return NULL;
} }

View File

@ -135,7 +135,7 @@ InitPathList(const char *path)
if (!path) if (!path)
return defaultPathList; return defaultPathList;
fullpath = xstrdup(path); fullpath = strdup(path);
if (!fullpath) if (!fullpath)
return NULL; return NULL;
elem = strtok(fullpath, ","); elem = strtok(fullpath, ",");
@ -353,7 +353,7 @@ InitSubdirs(const char **subdirlist)
sprintf(subdirs[i], "%s%s%s/", *s, slash, osname); sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
i++; i++;
/* path as given */ /* path as given */
subdirs[i] = xstrdup(*s); subdirs[i] = strdup(*s);
i++; i++;
s++; s++;
if (indefault && !s) { if (indefault && !s) {
@ -1246,7 +1246,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
} }
/* If there is no match, return the whole name minus the leading path */ /* If there is no match, return the whole name minus the leading path */
return xstrdup(s); return strdup(s);
} }
/* /*

View File

@ -659,11 +659,8 @@ xf86_cursors_fini (ScreenPtr screen)
xf86DestroyCursorInfoRec (xf86_config->cursor_info); xf86DestroyCursorInfoRec (xf86_config->cursor_info);
xf86_config->cursor_info = NULL; xf86_config->cursor_info = NULL;
} }
if (xf86_config->cursor_image) free(xf86_config->cursor_image);
{ xf86_config->cursor_image = NULL;
free(xf86_config->cursor_image);
xf86_config->cursor_image = NULL;
}
if (xf86_config->cursor) if (xf86_config->cursor)
{ {
FreeCursor (xf86_config->cursor, None); FreeCursor (xf86_config->cursor, None);

View File

@ -191,10 +191,8 @@ sparcPromClose(void)
close(promFd); close(promFd);
promFd = -1; promFd = -1;
} }
if (promOpio) { free(promOpio);
free(promOpio); promOpio = NULL;
promOpio = NULL;
}
promOpenCount = 0; promOpenCount = 0;
} }

View File

@ -595,12 +595,12 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
__glXScreenInit(&screen->base, pScreen); __glXScreenInit(&screen->base, pScreen);
screen->base.GLXversion = xstrdup("1.4"); screen->base.GLXversion = strdup("1.4");
screen->base.GLXextensions = xstrdup("GLX_SGIX_fbconfig " screen->base.GLXextensions = strdup("GLX_SGIX_fbconfig "
"GLX_SGIS_multisample " "GLX_SGIS_multisample "
"GLX_ARB_multisample " "GLX_ARB_multisample "
"GLX_EXT_visual_info " "GLX_EXT_visual_info "
"GLX_EXT_import_context "); "GLX_EXT_import_context ");
/*We may be able to add more GLXextensions at a later time. */ /*We may be able to add more GLXextensions at a later time. */

View File

@ -275,11 +275,8 @@ ddxGiveUp (void)
} }
/* Free concatenated command line */ /* Free concatenated command line */
if (g_pszCommandLine) free(g_pszCommandLine);
{ g_pszCommandLine = NULL;
free (g_pszCommandLine);
g_pszCommandLine = NULL;
}
/* Remove our keyboard hook if it is installed */ /* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL (); winRemoveKeyboardHookLL ();
@ -441,7 +438,7 @@ winFixupPaths (void)
int comment_block = FALSE; int comment_block = FALSE;
/* get defautl fontpath */ /* get defautl fontpath */
char *fontpath = xstrdup(defaultFontPath); char *fontpath = strdup(defaultFontPath);
size_t size = strlen(fontpath); size_t size = strlen(fontpath);
/* read all lines */ /* read all lines */
@ -528,7 +525,7 @@ winFixupPaths (void)
/* cleanup */ /* cleanup */
fclose(fontdirs); fclose(fontdirs);
defaultFontPath = xstrdup(fontpath); defaultFontPath = strdup(fontpath);
free(fontpath); free(fontpath);
changed_fontpath = TRUE; changed_fontpath = TRUE;
font_from = X_CONFIG; font_from = X_CONFIG;
@ -600,7 +597,7 @@ winFixupPaths (void)
} }
} }
defaultFontPath = xstrdup(newfp); defaultFontPath = strdup(newfp);
free(newfp); free(newfp);
changed_fontpath = TRUE; changed_fontpath = TRUE;
} }

View File

@ -676,7 +676,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs); fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
// Override the GL extensions string set by __glXScreenInit() // Override the GL extensions string set by __glXScreenInit()
screen->base.GLextensions = xstrdup(gl_extensions); screen->base.GLextensions = strdup(gl_extensions);
// Generate the GLX extensions string (overrides that set by __glXScreenInit()) // Generate the GLX extensions string (overrides that set by __glXScreenInit())
{ {
@ -706,13 +706,13 @@ glxWinScreenProbe(ScreenPtr pScreen)
if (screen->has_WGL_ARB_multisample) if (screen->has_WGL_ARB_multisample)
{ {
screen->base.GLXversion = xstrdup("1.4"); screen->base.GLXversion = strdup("1.4");
screen->base.GLXmajor = 1; screen->base.GLXmajor = 1;
screen->base.GLXminor = 4; screen->base.GLXminor = 4;
} }
else else
{ {
screen->base.GLXversion = xstrdup("1.3"); screen->base.GLXversion = strdup("1.3");
screen->base.GLXmajor = 1; screen->base.GLXmajor = 1;
screen->base.GLXminor = 3; screen->base.GLXminor = 3;
} }

View File

@ -583,7 +583,7 @@ winConfigFiles ()
else if (filesptr != NULL && filesptr->file_fontpath) else if (filesptr != NULL && filesptr->file_fontpath)
{ {
from = X_CONFIG; from = X_CONFIG;
defaultFontPath = xstrdup (filesptr->file_fontpath); defaultFontPath = strdup (filesptr->file_fontpath);
} }
winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath); winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath);
@ -630,7 +630,7 @@ winSetStrOption (pointer optlist, const char *name, char *deflt)
if (ParseOptionValue (-1, optlist, &o)) if (ParseOptionValue (-1, optlist, &o))
deflt = o.value.str; deflt = o.value.str;
if (deflt) if (deflt)
return xstrdup (deflt); return strdup (deflt);
else else
return NULL; return NULL;
} }

View File

@ -2520,8 +2520,6 @@ RecordDeleteContext(pointer value, XID id)
} }
} }
free(pContext);
/* remove context from AllContexts list */ /* remove context from AllContexts list */
if (-1 != (i = RecordFindContextOnAllContexts(pContext))) if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
@ -2533,6 +2531,8 @@ RecordDeleteContext(pointer value, XID id)
ppAllContexts = NULL; ppAllContexts = NULL;
} }
} }
free(pContext);
return Success; return Success;
} /* RecordDeleteContext */ } /* RecordDeleteContext */

View File

@ -114,10 +114,8 @@ register char *ptr;
} }
if (freeAll) { if (freeAll) {
(*num_inout)= (*sz_inout)= 0; (*num_inout)= (*sz_inout)= 0;
if (*elems) { free(*elems);
free(*elems); *elems = NULL;
*elems= NULL;
}
} }
else if (first+count>=(*num_inout)) else if (first+count>=(*num_inout))
*num_inout= first; *num_inout= first;
@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in)
{ {
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
if (prop->name) { free(prop->name);
free(prop->name); prop->name = NULL;
prop->name= NULL; free(prop->value);
} prop->value = NULL;
if (prop->value) {
free(prop->value);
prop->value= NULL;
}
return; return;
} }

View File

@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{ {
if ((!from)||(!into)) if ((!from)||(!into))
return BadMatch; return BadMatch;
if (into->map) { free(into->map);
free(into->map); into->map = NULL;
into->map= NULL; free(into->preserve);
} into->preserve = NULL;
if (into->preserve) { free(into->level_names);
free(into->preserve); into->level_names = NULL;
into->preserve= NULL;
}
if (into->level_names) {
free(into->level_names);
into->level_names= NULL;
}
*into= *from; *into= *from;
if ((from->map)&&(into->map_count>0)) { if ((from->map)&&(into->map_count>0)) {
into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec)); into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));

View File

@ -208,10 +208,7 @@ char tmpname[PATH_MAX];
return BadImplementation; return BadImplementation;
} }
list->nFound[what]= 0; list->nFound[what]= 0;
if (buf) { free(buf);
free(buf);
buf = NULL;
}
buf = malloc(PATH_MAX * sizeof(char)); buf = malloc(PATH_MAX * sizeof(char));
if (!buf) if (!buf)
return BadAlloc; return BadAlloc;

View File

@ -103,7 +103,7 @@ Win32System(const char *cmdline)
STARTUPINFO si; STARTUPINFO si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
DWORD dwExitCode; DWORD dwExitCode;
char *cmd = xstrdup(cmdline); char *cmd = strdup(cmdline);
ZeroMemory( &si, sizeof(si) ); ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si); si.cb = sizeof(si);
@ -235,6 +235,11 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
xkm_output_dir, keymap); xkm_output_dir, keymap);
free(xkbbasedirflag); free(xkbbasedirflag);
if (!buf) {
LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n");
return FALSE;
}
#ifndef WIN32 #ifndef WIN32
out= Popen(buf,"w"); out= Popen(buf,"w");

View File

@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client)
if ((XkbPaddedSize(len)/4)!=stuff->length) if ((XkbPaddedSize(len)/4)!=stuff->length)
return BadLength; return BadLength;
if ((status=XkbDDXList(dev,&list,client))!=Success) { if ((status=XkbDDXList(dev,&list,client))!=Success) {
if (list.pool) { free(list.pool);
free(list.pool); list.pool = NULL;
list.pool= NULL;
}
return status; return status;
} }
memset(&rep, 0, sizeof(xkbListComponentsReply)); memset(&rep, 0, sizeof(xkbListComponentsReply));
@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE); XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL; new= NULL;
} }
if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; } free(names.keycodes);
if (names.types) { free(names.types); names.types= NULL; } names.keycodes = NULL;
if (names.compat) { free(names.compat); names.compat= NULL; } free(names.types);
if (names.symbols) { free(names.symbols); names.symbols= NULL; } names.types = NULL;
if (names.geometry) { free(names.geometry); names.geometry= NULL; } free(names.compat);
names.compat = NULL;
free(names.symbols);
names.symbols = NULL;
free(names.geometry);
names.geometry = NULL;
return Success; return Success;
} }

View File

@ -635,10 +635,8 @@ unwind_key:
void void
XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeInfo(XkbSrvInfoPtr xkbi)
{ {
if (xkbi->radioGroups) { free(xkbi->radioGroups);
free(xkbi->radioGroups); xkbi->radioGroups = NULL;
xkbi->radioGroups= NULL;
}
if (xkbi->mouseKeyTimer) { if (xkbi->mouseKeyTimer) {
TimerFree(xkbi->mouseKeyTimer); TimerFree(xkbi->mouseKeyTimer);
xkbi->mouseKeyTimer= NULL; xkbi->mouseKeyTimer= NULL;

View File

@ -1761,15 +1761,15 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (sdoodad->any.type == XkbTextDoodad) { if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text) if (sdoodad->text.text)
ddoodad->text.text = ddoodad->text.text =
xstrdup(sdoodad->text.text); strdup(sdoodad->text.text);
if (sdoodad->text.font) if (sdoodad->text.font)
ddoodad->text.font = ddoodad->text.font =
xstrdup(sdoodad->text.font); strdup(sdoodad->text.font);
} }
else if (sdoodad->any.type == XkbLogoDoodad) { else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name) if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name = ddoodad->logo.logo_name =
xstrdup(sdoodad->logo.logo_name); strdup(sdoodad->logo.logo_name);
} }
} }
dsection->overlays = NULL; dsection->overlays = NULL;
@ -1832,14 +1832,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
if (sdoodad->any.type == XkbTextDoodad) { if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text) if (sdoodad->text.text)
ddoodad->text.text = xstrdup(sdoodad->text.text); ddoodad->text.text = strdup(sdoodad->text.text);
if (sdoodad->text.font) if (sdoodad->text.font)
ddoodad->text.font = xstrdup(sdoodad->text.font); ddoodad->text.font = strdup(sdoodad->text.font);
} }
else if (sdoodad->any.type == XkbLogoDoodad) { else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name) if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name = ddoodad->logo.logo_name =
xstrdup(sdoodad->logo.logo_name); strdup(sdoodad->logo.logo_name);
} }
} }