Changeset: 69aac5ce5938 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/69aac5ce5938
Modified Files:
        sql/backends/monet5/vaults/odbc/odbc_loader.c
Branch: Mar2025
Log Message:

Simplify logic + plug potential memory leak.


diffs (15 lines):

diff --git a/sql/backends/monet5/vaults/odbc/odbc_loader.c 
b/sql/backends/monet5/vaults/odbc/odbc_loader.c
--- a/sql/backends/monet5/vaults/odbc/odbc_loader.c
+++ b/sql/backends/monet5/vaults/odbc/odbc_loader.c
@@ -417,8 +417,10 @@ odbc_query(int caller, mvc *sql, sql_sub
                return "Incomplete ODBC URI string. Missing 'QUERY=' part to 
specify the SQL SELECT query to execute.";
 
        char * query = GDKstrdup(&qry_str[6]);  // we expect that QUERY= is at 
the end of the connection string
-       if (query == NULL || (query && (strcmp("", query) == 0)))
+       if (query == NULL || *query == 0) {
+               GDKfree(query);
                return "Incomplete ODBC URI string. Missing SQL SELECT query 
after 'QUERY='.";
+       }
 
        // create a new ODBC connection string without the QUERY= part
        char * odbc_con_str = GDKstrndup(con_str, qry_str - con_str);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to