diff options
-rw-r--r-- | xenodm/dm.c | 8 | ||||
-rw-r--r-- | xenodm/util.c | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/xenodm/dm.c b/xenodm/dm.c index 77920b5..59a0307 100644 --- a/xenodm/dm.c +++ b/xenodm/dm.c @@ -502,7 +502,7 @@ SetWindowPath(struct display *d) unsigned long bytes_after; unsigned char *buf; const char *windowpath; - char *newwindowpath; + char *newwindowpath = NULL; unsigned long num; prop = XInternAtom(d->dpy, "XFree86_VT", False); @@ -549,9 +549,11 @@ SetWindowPath(struct display *d) XFree(buf); windowpath = getenv("WINDOWPATH"); if (!windowpath) { - asprintf(&newwindowpath, "ttyC%lu", num - 1); + if (asprintf(&newwindowpath, "ttyC%lu", num - 1) == -1) + return; } else { - asprintf(&newwindowpath, "%s:%lu", windowpath, num); /* XXX */ + if (asprintf(&newwindowpath, "%s:%lu", windowpath, num) == -1) + return; } free(d->windowPath); d->windowPath = newwindowpath; diff --git a/xenodm/util.c b/xenodm/util.c index 8f6cfe5..5097d44 100644 --- a/xenodm/util.c +++ b/xenodm/util.c @@ -54,12 +54,11 @@ makeEnv (const char *name, const char *value) { char *result; - asprintf(&result, "%s=%s", name, value); - - if (!result) { + if (asprintf(&result, "%s=%s", name, value) == -1) { LogOutOfMem ("makeEnv"); return NULL; } + return result; } |