- fixed a crash in mysql_stmt_fetch when the statement does not exist
authorJan Janak <jan@iptel.org>
Sun, 1 Jun 2008 19:22:15 +0000 (19:22 +0000)
committerJan Janak <jan@iptel.org>
Sun, 1 Jun 2008 19:22:15 +0000 (19:22 +0000)
modules/db_mysql/my_cmd.c

index af690ef..c0c5442 100644 (file)
@@ -1231,6 +1231,12 @@ int my_cmd_next(db_res_t* res)
 
        mcmd = DB_GET_PAYLOAD(res->cmd);
        if (mcmd->next_flag == 2 || mcmd->next_flag == -2) return 1;
+
+       if (mcmd->st == NULL) {
+               ERR("mysql: Prepared statement not found\n");
+               return -1;
+       }
+
        ret = mysql_stmt_fetch(mcmd->st);
        
        if (ret == MYSQL_NO_DATA) {