Skip to content

Commit

Permalink
removed free and set ch ptrs to null
Browse files Browse the repository at this point in the history
  • Loading branch information
kelliemogg committed Nov 24, 2020
1 parent 52576d7 commit b287f1f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions dir_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
char *dir_search(char **argv, char **path_tokens)
{
struct dirent *dir_store;
DIR *deer;
DIR *deer = NULL;
int i;
char *asdf;
char *store;
char *asdf = NULL;
char *store = NULL;

for (i = 0; path_tokens[i] != '\0'; i++)
{
Expand All @@ -28,7 +28,7 @@ char *dir_search(char **argv, char **path_tokens)
}
closedir(deer);
}
free(path_tokens);
/* free(path_tokens); */
return (NULL);
}
/**
Expand Down
6 changes: 3 additions & 3 deletions getenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ char **_get_env(char *env)
{
int inner;
int outer;
char *name;
char *name = NULL;

for (outer = 0; environ[outer] != NULL; outer++)
{
Expand Down Expand Up @@ -39,9 +39,9 @@ char **_env_parser(char *name)
{
int token_inc;
int tokencount;
char *tokenize;
char *tokenize = NULL;
int i;
char **p;
char **p = NULL;
char *namestore = name;

tokencount = 0;
Expand Down
2 changes: 1 addition & 1 deletion helperfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int stringlength(char *s)
**/
char *_strdup(char *str)
{
char *duplicate;
char *duplicate = NULL;
int i;
int len = 0;

Expand Down
10 changes: 5 additions & 5 deletions shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ int main(int argc, char **argv)
int shell_loop(int argc, char **argv)
{
int userinput;
char *buffer;
char *buffer = NULL;
size_t bufsize;
char *prompt = "$ ";
char **path_tokens;
char *executable;
char **path_tokens = NULL;
char *executable = NULL;
va_list args_list;

(void) argc;
Expand Down Expand Up @@ -72,8 +72,8 @@ return (0);
char **tokenize(char *userinput)
{
int token_inc = 0;
char *tokenize;
char **argv;
char *tokenize = NULL;
char **argv = NULL;
int tokencount = 0;
int i;

Expand Down

0 comments on commit b287f1f

Please sign in to comment.