xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 98f76bb4843c745f48ba55c24b4db8398557b9c3

Fix several memory leaks and errors
Author: xaizek
Author date (UTC): 2012-02-18 18:32
Committer name: xaizek
Committer date (UTC): 2012-02-18 18:32
Parent(s): 5518032eab5a4ce0dec518e950542debad82a8f4
Signing key:
Tree: f73664e1ec816cfd310b81a0d69a27dac0b1ae56
File Lines added Lines deleted
src/commands.c 4 3
src/filelist.c 5 5
src/keys.c 2 0
src/options.c 4 0
tests/misc/cmdline_completion.c 1 0
File src/commands.c changed (mode: 100644) (index e3dfe1a62..bf6c34273)
... ... split_path(void)
1449 1449
1450 1450 path = env_get("PATH"); path = env_get("PATH");
1451 1451
1452 if(paths != NULL)
1453 free_string_array(paths, paths_count);
1454
1452 1455 paths_count = 1; paths_count = 1;
1453 1456 p = path; p = path;
1454 1457 while((p = strchr(p, ':')) != NULL) while((p = strchr(p, ':')) != NULL)
 
... ... expand_macros(FileView *view, const char *command, const char *args,
2102 2105 } }
2103 2106 assert(x >= y); assert(x >= y);
2104 2107 assert(y <= cmd_len); assert(y <= cmd_len);
2105 expanded = realloc(expanded, len + cmd_len + 1);
2108 expanded = realloc(expanded, len + (x - y) + 1);
2106 2109 strncat(expanded, command + y, x - y); strncat(expanded, command + y, x - y);
2107 2110 len = strlen(expanded); len = strlen(expanded);
2108 2111 x++; x++;
2109 2112 } }
2110 2113 while(x < cmd_len); while(x < cmd_len);
2111 2114
2112 len++;
2113 expanded[len] = '\0';
2114 2115 if(len > cfg.max_args/2) if(len > cfg.max_args/2)
2115 2116 (void)show_error_msg("Argument is too long", " FIXME "); (void)show_error_msg("Argument is too long", " FIXME ");
2116 2117
File src/filelist.c changed (mode: 100644) (index 204873ba6..a4a895462)
... ... void
533 533 get_all_selected_files(FileView *view) get_all_selected_files(FileView *view)
534 534 { {
535 535 int x; int x;
536 int y = 0;
536 int y;
537 537
538 538 count_selected(view); count_selected(view);
539 539
 
... ... get_all_selected_files(FileView *view)
548 548 if(view->selected_filelist != NULL) if(view->selected_filelist != NULL)
549 549 { {
550 550 free_selected_file_array(view); free_selected_file_array(view);
551 /* restoring this because free_selected_file_array sets it to zero */
552 view->selected_files = y;
551 /* setting this because free_selected_file_array doesn't do it */
552 view->selected_files = 0;
553 553 } }
554 view->selected_filelist =
555 (char **)calloc(view->selected_files, sizeof(char *));
554 count_selected(view);
555 view->selected_filelist = calloc(view->selected_files, sizeof(char *));
556 556 if(view->selected_filelist == NULL) if(view->selected_filelist == NULL)
557 557 { {
558 558 (void)show_error_msg("Memory Error", "Unable to allocate enough memory"); (void)show_error_msg("Memory Error", "Unable to allocate enough memory");
File src/keys.c changed (mode: 100644) (index a911e35a0..aec96a656)
... ... remove_user_keys(const wchar_t *keys, int mode)
553 553 curr->prev->next = curr->next; curr->prev->next = curr->next;
554 554 else else
555 555 parent->child = curr->next; parent->child = curr->next;
556 if(curr->next != NULL)
557 curr->next->prev = curr->prev;
556 558 free(curr); free(curr);
557 559 curr = parent; curr = parent;
558 560 } }
File src/options.c changed (mode: 100644) (index a3271824e..94b36c66d)
... ... clear_options(void)
108 108 { {
109 109 free(options[i].name); free(options[i].name);
110 110 if(options[i].type == OPT_STR || options[i].type == OPT_STRLIST) if(options[i].type == OPT_STR || options[i].type == OPT_STRLIST)
111 {
112 if(options[i].full == NULL)
113 free(options[i].def.str_val);
111 114 free(options[i].val.str_val); free(options[i].val.str_val);
115 }
112 116 } }
113 117 free(options); free(options);
114 118 options = NULL; options = NULL;
File tests/misc/cmdline_completion.c changed (mode: 100644) (index 3dae89794..d7368d261)
... ... teardown(void)
47 47 { {
48 48 free(stats.line); free(stats.line);
49 49 reset_cmds(); reset_cmds();
50 clear_options();
50 51 } }
51 52
52 53 static void static void
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master