Only set buf to blank before the goto.
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 15 Oct 2008 17:16:00 +0000 (17:16 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 15 Oct 2008 17:16:00 +0000 (17:16 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@149640 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_odbc.c

index 37b27d5..2a45933 100644 (file)
@@ -452,6 +452,7 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha
                        if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
                                ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql->str);
                                y = -1;
                        if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
                                ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql->str);
                                y = -1;
+                               buf[0] = '\0';
                                goto end_acf_read;
                        }
 
                                goto end_acf_read;
                        }
 
@@ -520,8 +521,6 @@ end_acf_read:
                }
                odbc_store->data = resultset;
                ast_channel_datastore_add(chan, odbc_store);
                }
                odbc_store->data = resultset;
                ast_channel_datastore_add(chan, odbc_store);
-       } else {
-               buf[0] = '\0';
        }
        SQLCloseCursor(stmt);
        SQLFreeHandle(SQL_HANDLE_STMT, stmt);
        }
        SQLCloseCursor(stmt);
        SQLFreeHandle(SQL_HANDLE_STMT, stmt);