Vlasdislav commented on code in PR #1979:
URL: https://github.com/apache/cloudberry/pull/1979#discussion_r3976515428


##########
src/interfaces/libpq/fe-auth-scram.c:
##########
@@ -147,6 +154,21 @@ scram_init(PGconn *conn,
        }
        state->password = prep_password;
 
+       /* Cloudberry */
+       /* After additional linkage frontend code into backend, this function
+        * may be called on the server side. `pg_saslprep` is compiled for
+        * backend with palloc memory allocation, but original `scram_free` 
releases
+        * the memory with `free` and it leads to abort of running process.
+        * Reallocation of password right after incorrect allocation seems less
+        * confusing than usage `free`/`pfree` based on build macro at 
scram_free
+        * only for password field.
+        */
+#ifndef FRONTEND
+       state->password = strdup(prep_password);
+       pfree(prep_password);
+#endif

Review Comment:
   ```suggestion
   #ifndef FRONTEND
        state->password = strdup(prep_password);
        pfree(prep_password);
   #else
       state->password = prep_password;
   #endif
   ```



##########
src/interfaces/libpq/fe-auth-scram.c:
##########
@@ -147,6 +154,21 @@ scram_init(PGconn *conn,
        }
        state->password = prep_password;

Review Comment:
   IMHO https://github.com/apache/cloudberry/pull/1979/changes#r3976515428



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to