dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 4eb8a7a3d6e30d77c1340b7ef6abd65d0982afe7
parent 52aadee0a0c7f0040fb05c2f0d5eb99d2052728c
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Wed, 13 Mar 2013 17:49:06 +0100

Handle allocation failures more gracefully

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
dvtm.c | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -717,8 +717,17 @@ create(const char *args[]) { NULL }; - c->window = newwin(wah, waw, way, wax); - c->term = vt_create(screen.h - 1, screen.w, screen.history); + if (!(c->window = newwin(wah, waw, way, wax))) { + free(c); + return; + } + + if (!(c->term = vt_create(screen.h - 1, screen.w, screen.history))) { + delwin(c->window); + free(c); + return; + } + c->cmd = cmd; if (args && args[1]) { strncpy(c->title, args[1], sizeof(c->title) - 1);