i3bar: Fix memory for old plain-text input (Thanks Han)

This commit is contained in:
Michael Stapelberg 2012-03-19 22:30:20 +01:00
parent e7761a342b
commit 607ba6fcde
1 changed files with 2 additions and 0 deletions

View File

@ -213,6 +213,8 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
free(buffer); free(buffer);
} else { } else {
struct status_block *first = TAILQ_FIRST(&statusline_head); struct status_block *first = TAILQ_FIRST(&statusline_head);
/* Clear the old buffer if any. */
FREE(first->full_text);
/* Remove the trailing newline and terminate the string at the same /* Remove the trailing newline and terminate the string at the same
* time. */ * time. */
buffer[rec-1] = '\0'; buffer[rec-1] = '\0';