Skip to content

Commit

Permalink
Fix uninitizlized data warning
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Jan 29, 2024
1 parent 2467fce commit e3b131d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hoel-pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static unsigned short h_get_type_from_oid(const struct _h_connection * conn, Oid
int h_execute_query_pgsql(const struct _h_connection * conn, const char * query, struct _h_result * result) {
PGresult * res;
int nfields, ntuples, i, j, h_res, ret = H_OK, nlength;
struct _h_data * data, * cur_row = NULL;
struct _h_data * data = NULL, * cur_row = NULL;

if (pthread_mutex_lock(&(((struct _h_pgsql *)conn->connection)->lock))) {
ret = H_ERROR_QUERY;
Expand Down Expand Up @@ -269,8 +269,12 @@ int h_execute_query_pgsql(const struct _h_connection * conn, const char * query,
break;
}
}
h_res = h_row_add_data(&cur_row, data, j);
h_clean_data_full(data);
if (data != NULL) {
h_res = h_row_add_data(&cur_row, data, j);
h_clean_data_full(data);
} else {
h_res = H_ERROR_PARAMS;
}
if (h_res != H_OK) {
PQclear(res);
ret = h_res;
Expand Down

0 comments on commit e3b131d

Please sign in to comment.