[X2Go-Commits] [nx-libs] 27/29: Error.c: replace malloc+strcpy by strdup
git-admin at x2go.org
git-admin at x2go.org
Sun Jan 7 01:31:00 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x
in repository nx-libs.
commit b89b8094934856ae2f2b0e3bca83d3fe171f87b9
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Wed Jan 3 02:34:10 2018 +0100
Error.c: replace malloc+strcpy by strdup
---
nx-X11/programs/Xserver/hw/nxagent/Error.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index 7abd83a..f5fb297 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
@@ -524,6 +524,7 @@ char *nxagentGetSessionPath(void)
return NULL;
}
+ /* FIXME: necessary? */
snprintf(nxagentSessionDir, DEFAULT_STRING_LENGTH, "%s", rootPath);
if (strlen(nxagentSessionDir) + strlen("/C-") + strlen(nxagentSessionId) > DEFAULT_STRING_LENGTH - 1)
@@ -562,9 +563,9 @@ char *nxagentGetSessionPath(void)
}
- sessionPath = malloc(strlen(nxagentSessionDir) + 1);
+ sessionPath = strdup(nxagentSessionDir);
- if (sessionPath == NULL)
+ if (sessionPath == NULL)
{
#ifdef PANIC
fprintf(stderr, "nxagentGetSessionPath:: PANIC! Can't allocate memory for the session path.\n");
@@ -573,9 +574,6 @@ char *nxagentGetSessionPath(void)
return NULL;
}
-
- strcpy(sessionPath, nxagentSessionDir);
-
return sessionPath;
}
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list