Issue 626275: missing DECREF's in embedding example (original) (raw)

Extending and Embedding Python, chapter 5.3 Pure Embedding

There's a large example.

I think there are some Py_DECREF's missing in the error handling cases:

else { PyErr_Print(); fprintf(stderr, "Call failed\n"); return 1; }

--> this one misses IMHO Py_DECREF(pArgs); Py_DECREF(pModule); Py_DECREF(pName);

else { PyErr_Print(); fprintf(stderr, "Failed to load "%s"\n", argv[1]); return 1; }

--> this one misses IMHO Py_DECREF(pName);

I'm no Python expert, so I may be wrong - please check!

If they're not necessary in these cases, you should perhaps add a comment explaining the reason to the docs...