PGresult *res;
const char *paramValues[3];
char ctr[10], use[10];
+ int r = 0;
paramValues[0] = uid;
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
fprintf(stderr, "UPDATE failed: %s\n", PQerrorMessage(db_conn));
- PQclear(res);
- return -1;
- /* XXX Better error handling.*/
+ r = -1;
+ goto free_mem;
}
assert(PQntuples(res) == 0);
+
+free_mem:
PQclear(res);
- return 0;
+ return r;
}
static int get_data_for_uid(char *uid, struct ykc_stats *stats)