summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/process-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index b5b068ad38..20768b715a 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -161,6 +161,8 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
if (len > 0)
r[len] = 0;
+ else
+ r = mfree(r);
} else {
bool dotdotdot = false;
@@ -214,7 +216,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
}
strncpy(k, "...", left-1);
- k[left] = 0;
+ k[left-1] = 0;
} else
*k = 0;
}