Index: funcs/func_odbc.c =================================================================== --- funcs/func_odbc.c (revision 255321) +++ funcs/func_odbc.c (working copy) @@ -275,7 +275,8 @@ struct odbc_datastore_row *row = NULL; struct ast_str *sql = ast_str_create(16); - if (!sql) { + if (!sql || !colnames) { + ast_free(sql); return -1; } @@ -400,6 +401,10 @@ for (x = 0; x < colcount; x++) { int i; struct ast_str *coldata = ast_str_thread_get(&coldata_buf, 16); + if (!coldata) { + ast_free(sql); + return -1; + } if (y == 0) { char colname[256];