mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
fix possible mem leak in prepare_diskio_stat, fix return value on failure
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1088 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
0ee3efdc0f
commit
bbdbf3b4e3
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
2008-03-30
|
2008-03-30
|
||||||
* Added mem_res and mem_vsize to $top.
|
* Added mem_res and mem_vsize to $top.
|
||||||
|
* Improved parsing of diskio args
|
||||||
|
|
||||||
2008-03-29
|
2008-03-29
|
||||||
* Increased C99 compliance.
|
* Increased C99 compliance.
|
||||||
|
@ -69,6 +69,10 @@ struct diskio_stat *prepare_diskio_stat(const char *s)
|
|||||||
ERR("too many diskio stats");
|
ERR("too many diskio stats");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (new->dev) {
|
||||||
|
free(new->dev);
|
||||||
|
new->dev = 0;
|
||||||
|
}
|
||||||
if (strncmp(s, "/dev/", 5) == 0) {
|
if (strncmp(s, "/dev/", 5) == 0) {
|
||||||
// supplied a /dev/device arg, so cut off the /dev part
|
// supplied a /dev/device arg, so cut off the /dev part
|
||||||
new->dev = strndup(s + 5, text_buffer_size);
|
new->dev = strndup(s + 5, text_buffer_size);
|
||||||
@ -98,6 +102,7 @@ struct diskio_stat *prepare_diskio_stat(const char *s)
|
|||||||
fp = 0;
|
fp = 0;
|
||||||
if (!found) {
|
if (!found) {
|
||||||
ERR("diskio device '%s' does not exist", s);
|
ERR("diskio device '%s' does not exist", s);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
new->current = 0;
|
new->current = 0;
|
||||||
new->current_read = 0;
|
new->current_read = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user