From f380e7d4b026d502801d32a809d928994717f1f8 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Thu, 3 Apr 2014 13:32:56 +0300 Subject: [PATCH] Check for malloc failure. --- src/encmain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/encmain.c b/src/encmain.c index fea5f5be..5731e5c3 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -147,8 +147,9 @@ int main(int argc, char *argv[]) sprintf(dim_str, "_%dx%d.yuv", cfg->width, cfg->height); left_len = strlen(cfg->debug); right_len = strlen(dim_str); - realloc(cfg->debug, left_len + right_len + 1); - strcpy(cfg->debug + left_len, dim_str); + if (realloc(cfg->debug, left_len + right_len + 1)) { + strcpy(cfg->debug + left_len, dim_str); + } } // Do more validation to make sure the parameters we have make sense.