From: <bre...@us...> - 2008-03-31 03:56:20
|
Revision: 1088 http://conky.svn.sourceforge.net/conky/?rev=1088&view=rev Author: brenden1 Date: 2008-03-30 20:56:03 -0700 (Sun, 30 Mar 2008) Log Message: ----------- fix possible mem leak in prepare_diskio_stat, fix return value on failure Modified Paths: -------------- trunk/conky1/ChangeLog trunk/conky1/src/diskio.c Modified: trunk/conky1/ChangeLog =================================================================== --- trunk/conky1/ChangeLog 2008-03-31 03:51:29 UTC (rev 1087) +++ trunk/conky1/ChangeLog 2008-03-31 03:56:03 UTC (rev 1088) @@ -2,6 +2,7 @@ 2008-03-30 * Added mem_res and mem_vsize to $top. + * Improved parsing of diskio args 2008-03-29 * Increased C99 compliance. Modified: trunk/conky1/src/diskio.c =================================================================== --- trunk/conky1/src/diskio.c 2008-03-31 03:51:29 UTC (rev 1087) +++ trunk/conky1/src/diskio.c 2008-03-31 03:56:03 UTC (rev 1088) @@ -69,6 +69,10 @@ ERR("too many diskio stats"); return 0; } + if (new->dev) { + free(new->dev); + new->dev = 0; + } if (strncmp(s, "/dev/", 5) == 0) { // supplied a /dev/device arg, so cut off the /dev part new->dev = strndup(s + 5, text_buffer_size); @@ -98,6 +102,7 @@ fp = 0; if (!found) { ERR("diskio device '%s' does not exist", s); + return 0; } new->current = 0; new->current_read = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |