Fix minor memory leak, changed standard ansi->c99
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
STND=-ansi
|
STND=-std=c99
|
||||||
CFLAGS = $(STND) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \
|
CFLAGS = $(STND) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \
|
||||||
-Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \
|
-Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \
|
||||||
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls \
|
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls \
|
||||||
|
4
mpc.c
4
mpc.c
@@ -2210,9 +2210,9 @@ static mpc_val_t *mpcf_re_range(mpc_val_t *x) {
|
|||||||
int comp = s[0] == '^' ? 1 : 0;
|
int comp = s[0] == '^' ? 1 : 0;
|
||||||
char *range = calloc(1,1);
|
char *range = calloc(1,1);
|
||||||
|
|
||||||
if (s[0] == '\0') { free(x); return mpc_fail("Invalid Regex Range Expression"); }
|
if (s[0] == '\0') { free(range); free(x); return mpc_fail("Invalid Regex Range Expression"); }
|
||||||
if (s[0] == '^' &&
|
if (s[0] == '^' &&
|
||||||
s[1] == '\0') { free(x); return mpc_fail("Invalid Regex Range Expression"); }
|
s[1] == '\0') { free(range); free(x); return mpc_fail("Invalid Regex Range Expression"); }
|
||||||
|
|
||||||
for (i = comp; i < strlen(s); i++){
|
for (i = comp; i < strlen(s); i++){
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user