From 489421b9e763865881df614a3ef550b289409677 Mon Sep 17 00:00:00 2001 From: Érico Rolim Date: Thu, 22 Oct 2020 03:47:15 -0300 Subject: imv, ipc: improve error checking for ipc creation. Since this isn't essential functionality, it's ok to simply not provide it. In cases where XDG_RUNTIME_DIR was empty (but not unset) or set to a directory where the user didn't have write permissions, socket creation would fail and lead to segmentation faults in imv, due to the return value of imv_ipc_create() not being checked. --- src/ipc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ipc.c') diff --git a/src/ipc.c b/src/ipc.c index 180bf2b..565777c 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -92,6 +92,9 @@ struct imv_ipc *imv_ipc_create(void) } struct imv_ipc *ipc = calloc(1, sizeof *ipc); + if (ipc == NULL) { + return NULL; + } ipc->fd = sockfd; pthread_t thread; -- cgit v1.2.3