From a00d4b8d161929397e86dd1f0db8661c28c46a4e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 10 Feb 2009 17:30:52 -0500 Subject: [PATCH] Handle NULL file names. --- mojoshader_preprocessor.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index 62a82ea5..4f46afc3 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -198,11 +198,14 @@ static int push_source(Context *ctx, const char *fname, const char *source, return 0; memset(state, '\0', sizeof (IncludeState)); - state->filename = StrDup(ctx, fname); - if (state->filename == NULL) + if (fname != NULL) { - Free(ctx, state); - return 0; + state->filename = StrDup(ctx, fname); + if (state->filename == NULL) + { + Free(ctx, state); + return 0; + } // if } // if state->included = included;