Commit 7cb829b7 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

proc: don't leak memory

CID 73370: Resource leak (RESOURCE_LEAK)
13. leaked_storage: Variable timer going out of scope leaks the storage it points to.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1eb8b9b1
...@@ -1619,30 +1619,31 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args) ...@@ -1619,30 +1619,31 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
while (1) { while (1) {
char pbuf[17]; /* 16 + eol */ char pbuf[17]; /* 16 + eol */
if (!(s = breadline(&f)))
goto out;
timer = xzalloc(sizeof(struct proc_posix_timer)); timer = xzalloc(sizeof(struct proc_posix_timer));
if (timer == NULL) if (timer == NULL)
goto err; goto err;
if (!(s = breadline(&f)))
goto out;
if (sscanf(s, "ID: %ld", if (sscanf(s, "ID: %ld",
&timer->spt.it_id) != 1) &timer->spt.it_id) != 1)
goto err; goto errf;
if (!(s = breadline(&f))) if (!(s = breadline(&f)))
goto err; goto errf;
if (sscanf(s, "signal: %d/%16s", if (sscanf(s, "signal: %d/%16s",
&timer->spt.si_signo, pbuf) != 2) &timer->spt.si_signo, pbuf) != 2)
goto err; goto errf;
if (!(s = breadline(&f))) if (!(s = breadline(&f)))
goto err; goto errf;
if (sscanf(s, "notify: %6[a-z]/%3[a-z].%d\n", if (sscanf(s, "notify: %6[a-z]/%3[a-z].%d\n",
sigpid, tidpid, &pid_t) != 3) sigpid, tidpid, &pid_t) != 3)
goto err; goto errf;
if (!(s = breadline(&f))) if (!(s = breadline(&f)))
goto err; goto errf;
if (sscanf(s, "ClockID: %d\n", if (sscanf(s, "ClockID: %d\n",
&timer->spt.clock_id) != 1) &timer->spt.clock_id) != 1)
goto err; goto errf;
timer->spt.sival_ptr = NULL; timer->spt.sival_ptr = NULL;
if (sscanf(pbuf, "%p", &timer->spt.sival_ptr) != 1 && if (sscanf(pbuf, "%p", &timer->spt.sival_ptr) != 1 &&
......
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