X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=blobdiff_plain;f=src%2Ftrackfds.h;h=5896cbb4ee3eb223db010131253bb609d45de774;hp=74d27aa4d4484fc08eaf97e9f05f0ed9481e1627;hb=feff94de6be535f17f06e3c135366b33ab9c0ca3;hpb=7ea72c40db03659a9d468f000d59ff133aadf47e diff --git a/src/trackfds.h b/src/trackfds.h index 74d27aa..5896cbb 100644 --- a/src/trackfds.h +++ b/src/trackfds.h @@ -66,10 +66,8 @@ static void init_from_environment(void) { return; } /* Environment is read-only. */ - char *env_copy = strdup(env); - if (!env_copy) { - return; - } + char env_copy[strlen(env) + 1]; + strcpy(env_copy, env); char *x; @@ -83,7 +81,6 @@ static void init_from_environment(void) { tracked_fds = malloc(tracked_fds_space * sizeof(*tracked_fds)); if (!tracked_fds) { - free(env_copy); return; } @@ -114,8 +111,6 @@ static void init_from_environment(void) { tracked_fds_count = count; - free(env_copy); - #ifdef DEBUG tracked_fds_debug(); #endif