Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite42e2f3

Browse files
committed
PL/Python: Fix potential NULL pointer dereference
Afterd0aa965, one error path inPLy_spi_execute_fetch_result() could result in the variable "result"being dereferenced after being set to NULL. To fix that, just clear theresources right there and return early.Also add another SPI_freetuptable() call so that that is cleared in allerror paths.discovered by John Naylor <jcnaylor@gmail.com> via scan-build
1 parent7b88d63 commite42e2f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/pl/plpython/plpy_spi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 rows, int status)
361361

362362
result= (PLyResultObject*)PLy_result_new();
363363
if (!result)
364+
{
365+
SPI_freetuptable(tuptable);
364366
returnNULL;
367+
}
365368
Py_DECREF(result->status);
366369
result->status=PyInt_FromLong(status);
367370

@@ -414,7 +417,9 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 rows, int status)
414417
if (!result->rows)
415418
{
416419
Py_DECREF(result);
417-
result=NULL;
420+
MemoryContextDelete(cxt);
421+
SPI_freetuptable(tuptable);
422+
returnNULL;
418423
}
419424
else
420425
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp