Avoid freeing unused memory. Some code clean-up.
Patch provided by David Hoyer.
This commit is contained in:
parent
ad50c8272e
commit
9bc925d0e9
@ -4,6 +4,8 @@ sysvinit (2.97) unreleased; urgency=low
|
|||||||
Added logsave and readbootlog to list of files git ignores.
|
Added logsave and readbootlog to list of files git ignores.
|
||||||
- Patches provided by Petr Ovtchenkov.
|
- Patches provided by Petr Ovtchenkov.
|
||||||
|
|
||||||
|
* Code clean-up and making sure we avoid freeing unused memory.
|
||||||
|
Patch provided by David Hoyer.
|
||||||
|
|
||||||
sysvinit (2.96) released; urgency=low
|
sysvinit (2.96) released; urgency=low
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ int readproc(int do_stat)
|
|||||||
if (p->argv0) free(p->argv0);
|
if (p->argv0) free(p->argv0);
|
||||||
if (p->argv1) free(p->argv1);
|
if (p->argv1) free(p->argv1);
|
||||||
if (p->statname) free(p->statname);
|
if (p->statname) free(p->statname);
|
||||||
free(p->pathname);
|
if (p->pathname) free(p->pathname);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
plist = NULL;
|
plist = NULL;
|
||||||
@ -562,7 +562,7 @@ int readproc(int do_stat)
|
|||||||
if (p->argv0) free(p->argv0);
|
if (p->argv0) free(p->argv0);
|
||||||
if (p->argv1) free(p->argv1);
|
if (p->argv1) free(p->argv1);
|
||||||
if (p->statname) free(p->statname);
|
if (p->statname) free(p->statname);
|
||||||
free(p->pathname);
|
if (p->pathname) free(p->pathname);
|
||||||
free(p);
|
free(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -578,19 +578,12 @@ int readproc(int do_stat)
|
|||||||
|
|
||||||
/* Get session, startcode, endcode. */
|
/* Get session, startcode, endcode. */
|
||||||
startcode = endcode = 0;
|
startcode = endcode = 0;
|
||||||
/*
|
if (sscanf(q, "%10s %*d %*d %d %*d %*d %*u %*u "
|
||||||
if (sscanf(q, "%*c %*d %*d %d %*d %*d %*u %*u "
|
|
||||||
"%*u %*u %*u %*u %*u %*d %*d "
|
"%*u %*u %*u %*u %*u %*d %*d "
|
||||||
"%*d %*d %*d %*d %*u %*u %*d "
|
"%*d %*d %*d %*d %*u %*u %*d "
|
||||||
"%*u %lu %lu",
|
"%*u %lu %lu",
|
||||||
&p->sid, &startcode, &endcode) != 3) {
|
process_status,
|
||||||
*/
|
&p->sid, &startcode, &endcode) != 4) {
|
||||||
if (sscanf(q, "%10s %*d %*d %d %*d %*d %*u %*u "
|
|
||||||
"%*u %*u %*u %*u %*u %*d %*d "
|
|
||||||
"%*d %*d %*d %*d %*u %*u %*d "
|
|
||||||
"%*u %lu %lu",
|
|
||||||
process_status,
|
|
||||||
&p->sid, &startcode, &endcode) != 4) {
|
|
||||||
|
|
||||||
p->sid = 0;
|
p->sid = 0;
|
||||||
nsyslog(LOG_ERR, "can't read sid from %s\n",
|
nsyslog(LOG_ERR, "can't read sid from %s\n",
|
||||||
@ -624,7 +617,7 @@ int readproc(int do_stat)
|
|||||||
if (p->argv0) free(p->argv0);
|
if (p->argv0) free(p->argv0);
|
||||||
if (p->argv1) free(p->argv1);
|
if (p->argv1) free(p->argv1);
|
||||||
if (p->statname) free(p->statname);
|
if (p->statname) free(p->statname);
|
||||||
free(p->pathname);
|
if (p->pathname) free(p->pathname);
|
||||||
free(p);
|
free(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -672,7 +665,7 @@ int readproc(int do_stat)
|
|||||||
if (p->argv0) free(p->argv0);
|
if (p->argv0) free(p->argv0);
|
||||||
if (p->argv1) free(p->argv1);
|
if (p->argv1) free(p->argv1);
|
||||||
if (p->statname) free(p->statname);
|
if (p->statname) free(p->statname);
|
||||||
free(p->pathname);
|
if (p->pathname) free(p->pathname);
|
||||||
free(p);
|
free(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user