Commit 684efc5e by Dwight Engen Committed by Stéphane Graber

coverity: fix resource leak

also fix the check if the string will fit the local buffer Signed-off-by: 's avatarDwight Engen <dwight.engen@oracle.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 77e22991
...@@ -422,8 +422,10 @@ static inline bool cgm_create(void *hdata) ...@@ -422,8 +422,10 @@ static inline bool cgm_create(void *hdata)
tmp = lxc_string_replace("%n", d->name, d->cgroup_pattern); tmp = lxc_string_replace("%n", d->name, d->cgroup_pattern);
if (!tmp) if (!tmp)
return false; return false;
if (strlen(tmp) > MAXPATHLEN) if (strlen(tmp) >= MAXPATHLEN) {
free(tmp);
return false; return false;
}
strcpy(result, tmp); strcpy(result, tmp);
baselen = strlen(result); baselen = strlen(result);
free(tmp); free(tmp);
......
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