mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcursor.git
synced 2026-05-05 00:38:10 +02:00
Use strdup() instead of malloc(strlen())+strcpy()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
2e6bda49d0
commit
bbf3c582c9
3 changed files with 8 additions and 15 deletions
|
|
@ -30,6 +30,10 @@ AC_INIT([libXcursor], [1.1.14],
|
|||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],[libXcursor])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h include/X11/Xcursor/Xcursor.h])
|
||||
# Set common system defines for POSIX extensions, such as _GNU_SOURCE
|
||||
# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
|
||||
# to avoid autoconf errors.
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
# Initialize Automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
|
|
|
|||
|
|
@ -216,17 +216,8 @@ _XcursorGetDisplayInfo (Display *dpy)
|
|||
v = XGetDefault (dpy, "Xcursor", "theme");
|
||||
if (v)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen (v) + 1;
|
||||
|
||||
info->theme = malloc (len);
|
||||
if (info->theme)
|
||||
strcpy (info->theme, v);
|
||||
|
||||
info->theme_from_config = malloc (len);
|
||||
if (info->theme_from_config)
|
||||
strcpy (info->theme_from_config, v);
|
||||
info->theme = strdup (v);
|
||||
info->theme_from_config = strdup (v);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -342,10 +333,9 @@ XcursorSetTheme (Display *dpy, const char *theme)
|
|||
|
||||
if (theme)
|
||||
{
|
||||
copy = malloc (strlen (theme) + 1);
|
||||
copy = strdup (theme);
|
||||
if (!copy)
|
||||
return XcursorFalse;
|
||||
strcpy (copy, theme);
|
||||
}
|
||||
else
|
||||
copy = NULL;
|
||||
|
|
|
|||
|
|
@ -86,12 +86,11 @@ XcursorImagesSetName (XcursorImages *images, const char *name)
|
|||
if (!images || !name)
|
||||
return;
|
||||
|
||||
new = malloc (strlen (name) + 1);
|
||||
new = strdup (name);
|
||||
|
||||
if (!new)
|
||||
return;
|
||||
|
||||
strcpy (new, name);
|
||||
if (images->name)
|
||||
free (images->name);
|
||||
images->name = new;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue