[svn-commits] dvossel: trunk r229093 - /trunk/res/res_config_pgsql.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 10 09:27:49 CST 2009


Author: dvossel
Date: Tue Nov 10 09:27:45 2009
New Revision: 229093

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=229093
Log:
fixes pgsql double free of threadstorage

A thread storage variable was being freed incorrectly, which
resulted in a double free if two queries were made in the same thread.

(closes issue #16011)
Reported by: cristiandimache
Patches:
      issue16011.diff uploaded by dvossel (license 671)


Modified:
    trunk/res/res_config_pgsql.c

Modified: trunk/res/res_config_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_config_pgsql.c?view=diff&rev=229093&r1=229092&r2=229093
==============================================================================
--- trunk/res/res_config_pgsql.c (original)
+++ trunk/res/res_config_pgsql.c Tue Nov 10 09:27:45 2009
@@ -678,7 +678,6 @@
 		ast_debug(1, "PostgreSQL RealTime: Query: %s\n", ast_str_buffer(sql));
 		ast_debug(1, "PostgreSQL RealTime: Query Failed because: %s\n", PQerrorMessage(pgsqlConn));
 		ast_mutex_unlock(&pgsql_lock);
-		ast_free(sql);
 		return -1;
 	} else {
 		ExecStatusType result_status = PQresultStatus(result);
@@ -691,14 +690,12 @@
 			ast_debug(1, "PostgreSQL RealTime: Query Failed because: %s (%s)\n",
 						PQresultErrorMessage(result), PQresStatus(result_status));
 			ast_mutex_unlock(&pgsql_lock);
-			ast_free(sql);
 			return -1;
 		}
 	}
 
 	numrows = atoi(PQcmdTuples(result));
 	ast_mutex_unlock(&pgsql_lock);
-	ast_free(sql);
 
 	ast_debug(1, "PostgreSQL RealTime: Updated %d rows on table: %s\n", numrows, tablename);
 




More information about the svn-commits mailing list