From aa3af70ae5f27ce4dc23d05b75c12df7cbf0165c Mon Sep 17 00:00:00 2001 From: Richard James Howe Date: Wed, 9 May 2018 19:36:00 +0100 Subject: [PATCH 1/2] Fix minor memory leak, changed standard ansi->c99 --- Makefile | 2 +- mpc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9a45c77..5f2af21 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC = gcc -STND=-ansi +STND=-std=c99 CFLAGS = $(STND) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \ -Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls \ diff --git a/mpc.c b/mpc.c index 1189815..f0a5916 100644 --- a/mpc.c +++ b/mpc.c @@ -2210,9 +2210,9 @@ static mpc_val_t *mpcf_re_range(mpc_val_t *x) { int comp = s[0] == '^' ? 1 : 0; 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] == '^' && - 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++){ From d3ea59b5e28325eaa59a2e7e304e06a86bcb01c2 Mon Sep 17 00:00:00 2001 From: Richard James Howe Date: Fri, 11 May 2018 00:01:41 +0100 Subject: [PATCH 2/2] Back to -ansi, removed trailing comma --- Makefile | 2 +- mpc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5f2af21..9a45c77 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC = gcc -STND=-std=c99 +STND=-ansi CFLAGS = $(STND) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \ -Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls \ diff --git a/mpc.c b/mpc.c index f0a5916..142c6fe 100644 --- a/mpc.c +++ b/mpc.c @@ -885,7 +885,7 @@ enum { MPC_TYPE_AND = 24, MPC_TYPE_CHECK = 25, - MPC_TYPE_CHECK_WITH = 26, + MPC_TYPE_CHECK_WITH = 26 }; typedef struct { char *m; } mpc_pdata_fail_t;