aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Error.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-11-21 11:47:04 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-11-21 11:47:04 +0100
commitce182e88a11c3f3a3218241a6046f3aeb08aabb7 (patch)
tree0c738dec27fdbdf055bf72caa0c96a57d6a706cf /nx-X11/programs/Xserver/hw/nxagent/Error.c
parent3b640a0f8de615e53dd6801ebd2aa0cf04f76c69 (diff)
parentdc43f4c98287b283747e47e37501c5ca158a8aa6 (diff)
downloadnx-libs-ce182e88a11c3f3a3218241a6046f3aeb08aabb7.tar.gz
nx-libs-ce182e88a11c3f3a3218241a6046f3aeb08aabb7.tar.bz2
nx-libs-ce182e88a11c3f3a3218241a6046f3aeb08aabb7.zip
Merge branch 'uli42-pr/simplify_free' into 3.6.x
Attributes GH PR #555: https://github.com/ArcticaProject/nx-libs/pull/555
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Error.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Error.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index 05d0f3081..c56275922 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
@@ -98,7 +98,7 @@ static char nxagentRootDir[DEFAULT_STRING_LENGTH] = { 0 };
static char nxagentSessionDir[DEFAULT_STRING_LENGTH] = { 0 };
-char *nxagentGetClientsPath(void);
+void nxagentGetClientsPath(void);
static int nxagentPrintError(Display *dpy, XErrorEvent *event, FILE *fp);
@@ -247,16 +247,9 @@ int nxagentExitHandler(const char *message)
void nxagentOpenClientsLogFile()
{
- char * clientsLogName;
-
if (*nxagentClientsLogName == '\0')
{
- clientsLogName = nxagentGetClientsPath();
-
- if (clientsLogName != NULL)
- {
- free(clientsLogName);
- }
+ nxagentGetClientsPath();
}
if (nxagentClientsLogName != NULL && *nxagentClientsLogName !='\0')
@@ -593,30 +586,27 @@ char *nxagentGetSessionPath(void)
return sessionPath;
}
-char *nxagentGetClientsPath()
+void nxagentGetClientsPath()
{
- char *sessionPath;
- char *clientsPath;
if (*nxagentClientsLogName == '\0')
{
- sessionPath = nxagentGetSessionPath();
+ char *sessionPath = nxagentGetSessionPath();
if (sessionPath == NULL)
{
- return NULL;
+ return;
}
if (strlen(sessionPath) + strlen("/clients") > DEFAULT_STRING_LENGTH - 1)
{
#ifdef PANIC
- fprintf(stderr, "nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path '%s'.\n",
- nxagentClientsLogName);
+ fprintf(stderr, "nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.\n");
#endif
free(sessionPath);
- return NULL;
+ return;
}
strcpy(nxagentClientsLogName, sessionPath);
@@ -626,19 +616,6 @@ char *nxagentGetClientsPath()
free(sessionPath);
}
- clientsPath = malloc(strlen(nxagentClientsLogName) + 1);
-
- if (clientsPath == NULL)
- {
- #ifdef PANIC
- fprintf(stderr, "nxagentGetClientsPath: PANIC! Can't allocate memory for the clients Log File Path path.\n");
- #endif
-
- return NULL;
- }
-
- strcpy(clientsPath, nxagentClientsLogName);
-
- return clientsPath;
+ return;
}