aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 12:41:28 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 12:41:28 -0400
commit9bccdc3dd3c473b6748cb5a93be7346c5c824cd4 (patch)
tree3a718702cd530a1a864d5744f2e34515d81f3adf /src/lib
parent3ad06f7dc738940ee31a21e3b95c0f3d3b8dbd6f (diff)
downloadstasis-9bccdc3dd3c473b6748cb5a93be7346c5c824cd4.tar.gz
handle asprintf errors
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/core/utils.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/core/utils.c b/src/lib/core/utils.c
index f8fcadb..b4fd726 100644
--- a/src/lib/core/utils.c
+++ b/src/lib/core/utils.c
@@ -893,9 +893,15 @@ int env_manipulate_pathstr(const char *key, char *path, int mode) {
char *system_path_new = NULL;
if (mode & PM_APPEND) {
- asprintf(&system_path_new, "%s%s%s", system_path_old, PATH_SEP, path);
+ if (asprintf(&system_path_new, "%s%s%s", system_path_old, PATH_SEP, path) < 0 || !system_path_new) {
+ SYSERROR("%s", "Unable to allocate memory to update PATH");
+ return -1;
+ }
} else if (mode & PM_PREPEND) {
- asprintf(&system_path_new, "%s%s%s", path, PATH_SEP, system_path_old);
+ if (asprintf(&system_path_new, "%s%s%s", path, PATH_SEP, system_path_old) < 0 || !system_path_new) {
+ SYSERROR("%s", "Unable to allocate memory to update PATH");
+ return -1;
+ }
}
if (!system_path_new) {