Commit 0e2c4df8 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Keyboard.c: fix memory leak

parent 3de6bc74
...@@ -1904,10 +1904,12 @@ void nxagentKeycodeConversionSetup(void) ...@@ -1904,10 +1904,12 @@ void nxagentKeycodeConversionSetup(void)
FILE *keyboard_file; FILE *keyboard_file;
if (!keyboard_file_path) if (!keyboard_file_path)
{ {
FatalError("nxagentKeycodeConversionSetup: malloc failed."); free(sessionpath);
FatalError("malloc for keyboard file path failed.");
} }
strcpy(keyboard_file_path, sessionpath); strcpy(keyboard_file_path, sessionpath);
strcat(keyboard_file_path, "/keyboard"); strcat(keyboard_file_path, "/keyboard");
free(sessionpath);
if ((keyboard_file = fopen(keyboard_file_path, "w"))) { if ((keyboard_file = fopen(keyboard_file_path, "w"))) {
if (drules) if (drules)
fprintf(keyboard_file, "rules=\"%s\"\n", drules[0] == '\0' ? "," : drules); fprintf(keyboard_file, "rules=\"%s\"\n", drules[0] == '\0' ? "," : drules);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment