Commit 2c608122 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Dave Airlie

shader: fix potential leak

Found thanks to llvm scan-build.
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 602e6870
......@@ -188,11 +188,13 @@ static inline bool fs_emit_layout(struct dump_ctx *ctx)
static char *strcat_realloc(char *str, const char *catstr)
{
str = realloc(str, strlen(str) + strlen(catstr) + 1);
if (!str)
char *new = realloc(str, strlen(str) + strlen(catstr) + 1);
if (!new) {
free(str);
return NULL;
strcat(str, catstr);
return str;
}
strcat(new, catstr);
return new;
}
static char *add_str_to_glsl_main(struct dump_ctx *ctx, char *buf)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment