diff options
author | Tonny Petersen <tsp@person.dk> | 2011-10-22 00:55:50 +0200 |
---|---|---|
committer | Tonny Petersen <tsp@person.dk> | 2011-10-22 10:03:00 +0200 |
commit | 98a6f0f4cf3777c700fd0f41e43c50d23b9816b9 (patch) | |
tree | ccd0df72a7f703e4f76e73015b10476369fc2fda /lib/cmyth/libcmyth/mythtv_mysql.c | |
parent | 79cceb52edf0a090d0fd27cbe6b7927cb3dab73d (diff) |
libcmyth bug fix:
*Wrong debug callback function
*Reference counting broken on linux
*cmyth_mysql_testdb_connection returns a pointer to a stack variable
*ref_reallof derefence NULL pointer in debug build
Diffstat (limited to 'lib/cmyth/libcmyth/mythtv_mysql.c')
-rw-r--r-- | lib/cmyth/libcmyth/mythtv_mysql.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/cmyth/libcmyth/mythtv_mysql.c b/lib/cmyth/libcmyth/mythtv_mysql.c index c11f47ae2f..3ff23fa6fc 100644 --- a/lib/cmyth/libcmyth/mythtv_mysql.c +++ b/lib/cmyth/libcmyth/mythtv_mysql.c @@ -936,7 +936,7 @@ cmyth_mythtv_remove_previos_recorded(cmyth_database_t db,char *query) int cmyth_mysql_testdb_connection(cmyth_database_t db,char **message) { - char buf[1000]; + char *buf=malloc(sizeof(char)*1001); int new_conn = 0; if (db->mysql != NULL) { if (mysql_stat(db->mysql) == NULL) { @@ -949,21 +949,21 @@ cmyth_mysql_testdb_connection(cmyth_database_t db,char **message) { new_conn = 1; if(db->mysql == NULL) { fprintf(stderr,"%s: mysql_init() failed, insufficient memory?", __FUNCTION__); - snprintf(buf, sizeof(buf), "mysql_init() failed, insufficient memory?"); + snprintf(buf, 1000, "mysql_init() failed, insufficient memory?"); *message=buf; return -1; } if (NULL == mysql_real_connect(db->mysql, db->db_host,db->db_user,db->db_pass,db->db_name,0,NULL,0)) { fprintf(stderr,"%s: mysql_connect() failed: %s\n", __FUNCTION__, mysql_error(db->mysql)); - snprintf(buf, sizeof(buf), "%s",mysql_error(db->mysql)); + snprintf(buf, 1000, "%s",mysql_error(db->mysql)); fprintf (stderr,"buf = %s\n",buf); *message=buf; cmyth_database_close(db); return -1; } } - snprintf(buf, sizeof(buf), "All Test Successful\n"); + snprintf(buf, 1000, "All Test Successful\n"); *message=buf; return 1; } |