From 24478bd6f4883f969fd88cb978ea06afcf36939f Mon Sep 17 00:00:00 2001 From: Michael Casebolt Date: Tue, 3 Mar 2015 15:40:04 -0800 Subject: [PATCH] Return from mpc_ast_print_depth if NULL Return from mpc_ast_print_depth after printing 'NULL' to avoid the potential segfault. --- mpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mpc.c b/mpc.c index d099daf..5c96ba7 100644 --- a/mpc.c +++ b/mpc.c @@ -2603,6 +2603,7 @@ static void mpc_ast_print_depth(mpc_ast_t *a, int d, FILE *fp) { if (a == NULL) { fprintf(fp, "NULL\n"); + return; } for (i = 0; i < d; i++) { fprintf(fp, " "); }