Fixed segfault
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
test.txt
|
||||||
|
|
||||||
# ---> C
|
# ---> C
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|||||||
4
main.c
4
main.c
@@ -33,7 +33,7 @@ int main (int argc, char* argv[]) {
|
|||||||
noecho();
|
noecho();
|
||||||
char ch = ' ';
|
char ch = ' ';
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char* cmd_string = malloc(cols);
|
char* cmd_string = malloc(128);
|
||||||
char (*content)[cols] = malloc(sizeof(char[rows][cols+1]));
|
char (*content)[cols] = malloc(sizeof(char[rows][cols+1]));
|
||||||
|
|
||||||
for (int i = 0; i < rows; i ++) {
|
for (int i = 0; i < rows; i ++) {
|
||||||
@@ -52,7 +52,7 @@ int main (int argc, char* argv[]) {
|
|||||||
insertInStartContent(content, cmd_string);
|
insertInStartContent(content, cmd_string);
|
||||||
len = 0;
|
len = 0;
|
||||||
clearInput(rows, cols);
|
clearInput(rows, cols);
|
||||||
cmd_string = "";
|
cmd_string = malloc(128);
|
||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user