aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-22 22:11:34 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-15 12:10:16 +0100
commit5bb9486608eb0d8965bbce0450d53a1b160ba138 (patch)
treece7f14cbcadd8d717c4f17f0004bcb8ac3bc395d /nx-X11
parent0755f3d6ceec9ef918903b52d4f3bb1a722e0e8d (diff)
downloadnx-libs-5bb9486608eb0d8965bbce0450d53a1b160ba138.tar.gz
nx-libs-5bb9486608eb0d8965bbce0450d53a1b160ba138.tar.bz2
nx-libs-5bb9486608eb0d8965bbce0450d53a1b160ba138.zip
Args.c: simplify options string allocation
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index cb18415db..2f0524dc1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -277,32 +277,18 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if ((!strcmp(argv[j], "-options") || !strcmp(argv[j], "-option")) && j + 1 < argc)
{
- if (nxagentOptionsFilenameOrString)
- {
- nxagentOptionsFilenameOrString = (char *) realloc(nxagentOptionsFilenameOrString, strlen(argv[j + 1]) + 1);
- }
- else
- {
- nxagentOptionsFilenameOrString = (char *) malloc(strlen(argv[j + 1]) +1);
- }
+ SAFE_free(nxagentOptionsFilenameOrString);
- if (nxagentOptionsFilenameOrString != NULL)
+ if (-1 == asprintf(&nxagentOptionsFilenameOrString, "%s", argv[j + 1]))
{
- nxagentOptionsFilenameOrString = strcpy(nxagentOptionsFilenameOrString, argv[j + 1]);
+ FatalError("malloc failed");
}
- #ifdef WARNING
- else
- {
- fprintf(stderr, "ddxProcessArgument: WARNING! failed string allocation.\n");
- }
- #endif
-
break;
}
}
nxagentProcessOptions(nxagentOptionsFilenameOrString);
- }
+ } /* if (resetOptions == True) */
if (!strcmp(argv[i], "-B"))
{