int4_int8_gen_series_leak-1.patch
text/x-patch
Filename: int4_int8_gen_series_leak-1.patch
Type: text/x-patch
Part: 1
Message:
Memory leaks on SRF rescan
Patch
Format: context
| File | + | − |
|---|---|---|
| src/backend/utils/adt/int8.c | 3 | 0 |
| src/backend/utils/adt/int.c | 3 | 0 |
Index: src/backend/utils/adt/int.c
===================================================================
RCS file: /home/neilc/postgres/cvs_root/pgsql/src/backend/utils/adt/int.c,v
retrieving revision 1.81
diff -p -c -r1.81 int.c
*** src/backend/utils/adt/int.c 1 Jan 2008 19:45:52 -0000 1.81
--- src/backend/utils/adt/int.c 22 Feb 2008 02:01:17 -0000
*************** generate_series_step_int4(PG_FUNCTION_AR
*** 1377,1382 ****
--- 1377,1385 ----
SRF_RETURN_NEXT(funcctx, Int32GetDatum(result));
}
else
+ {
/* do when there is no more left */
+ pfree(fctx);
SRF_RETURN_DONE(funcctx);
+ }
}
Index: src/backend/utils/adt/int8.c
===================================================================
RCS file: /home/neilc/postgres/cvs_root/pgsql/src/backend/utils/adt/int8.c,v
retrieving revision 1.68
diff -p -c -r1.68 int8.c
*** src/backend/utils/adt/int8.c 1 Jan 2008 19:45:52 -0000 1.68
--- src/backend/utils/adt/int8.c 22 Feb 2008 02:01:40 -0000
*************** generate_series_step_int8(PG_FUNCTION_AR
*** 1215,1220 ****
--- 1215,1223 ----
SRF_RETURN_NEXT(funcctx, Int64GetDatum(result));
}
else
+ {
/* do when there is no more left */
+ pfree(fctx);
SRF_RETURN_DONE(funcctx);
+ }
}