char *select_clause = NULL;
if (!streamname)
tmp = get_current_stream();
- else
+ else {
tmp = escape_str(streamname);
+ if (!tmp)
+ return NULL;
+ }
if (!strcmp(tmp, "(none)")) {
free(tmp);
if (filename) {
char *ret, *ebn = escaped_basename(filename);
+ if (!ebn)
+ return NULL;
ret = make_message("select to_days(now()) - "
"to_days(lastplayed) from data "
"where name = '%s'", ebn);
num = atoi(argv[1]);
if (!num)
return -E_MYSQL_SYNTAX;
- stream = (argc == 2)? get_current_stream() : escape_str(argv[2]);
+ if (argc == 2) {
+ stream = get_current_stream();
+ if (!stream)
+ return -E_GET_STREAM;
+ } else {
+ stream = escape_str(argv[2]);
+ if (!stream)
+ return -E_ESCAPE;
+ }
tmp = get_query(stream, NULL, 0);
+ free(stream);
+ if (!tmp)
+ return -E_GET_QUERY;
query = make_message("%s limit %d", tmp, num);
free(tmp);
- ret = -E_GET_QUERY;
- free(stream);
- if (!query)
- goto out;
ret = -E_NORESULT;
result = get_result(query);
free(query);
goto out;
send_va_buffer(fd, "new entry: %s\n", row[0]);
erow = escape_str(row[0]);
+ if (!erow)
+ goto out;
query = make_message("insert into data (name, pic_id) values "
"('%s','%s')", erow, "1");
free(erow);
tmp = get_query(stream, NULL, 1);
free(stream);
+ if (!tmp)
+ goto err_out;
query = make_message("%s limit %d", tmp, num);
free(tmp);
result = get_result(query);
goto out;
if (argc < 2)
conf.mysql_database_arg = para_strdup("paraslash");
- else
+ else {
+ ret = -E_ESCAPE;
conf.mysql_database_arg = escape_str(argv[1]);
+ if (!conf.mysql_database_arg)
+ goto out;
+ }
query = make_message("create database %s", conf.mysql_database_arg);
ret = real_query(query);
free(query);