Skip to content

Commit

Permalink
Fix memory leak on incorrect syntax
Browse files Browse the repository at this point in the history
babelouest committed Apr 29, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 42eebd3 commit cb309e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hoel-pgsql.c
Original file line number Diff line number Diff line change
@@ -214,6 +214,7 @@ int h_execute_query_pgsql(const struct _h_connection * conn, const char * query,
y_log_message(Y_LOG_LEVEL_ERROR, "Error executing sql query");
y_log_message(Y_LOG_LEVEL_DEBUG, "Error message: \"%s\"", PQerrorMessage(((struct _h_pgsql *)conn->connection)->db_handle));
y_log_message(Y_LOG_LEVEL_DEBUG, "Query: \"%s\"", query);
PQclear(res);
ret = H_ERROR_QUERY;
} else {
nfields = PQnfields(res);
@@ -304,6 +305,7 @@ int h_execute_query_json_pgsql(const struct _h_connection * conn, const char * q
y_log_message(Y_LOG_LEVEL_ERROR, "Error executing sql query");
y_log_message(Y_LOG_LEVEL_DEBUG, "Error message: \"%s\"", PQerrorMessage(((struct _h_pgsql *)conn->connection)->db_handle));
y_log_message(Y_LOG_LEVEL_DEBUG, "Query: \"%s\"", query);
PQclear(res);
ret = H_ERROR_QUERY;
} else {
nfields = PQnfields(res);

0 comments on commit cb309e7

Please sign in to comment.