diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 55c06f4f6f6cef5ef53e50fb70dde2f1ba9378f7..7f2de02fcb7faef8c7799a12d2e5b08ab733071a 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -502,8 +502,10 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha if (stmt) { break; } - ast_odbc_release_obj(obj); - obj = NULL; + if (obj) { + ast_odbc_release_obj(obj); + obj = NULL; + } } if (!stmt) {