File: duplicity/_librsyncmodule.c
Function: _librsync_new_deltamaker
Error: memory leak: ob_refcnt of '*dm' is 1 too high
170 static PyObject*
171 _librsync_new_deltamaker(PyObject* self, PyObject* args)
172 {
173   _librsync_DeltaMakerObject* dm;
174   char *sig_string, outbuf[RS_JOB_BLOCKSIZE];
175   Py_ssize_t sig_length;
176   rs_job_t *sig_loader;
177   rs_signature_t *sig_ptr;
178   rs_buffers_t buf;
179   rs_result result;
180 
181 #if PY_MAJOR_VERSION >= 3
182   if (!PyArg_ParseTuple(args,"y#:new_deltamaker", &sig_string, &sig_length))
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
183 #else
184   if (!PyArg_ParseTuple(args,"s#:new_deltamaker", &sig_string, &sig_length))
185 #endif
186     return NULL;
187 
188   dm = PyObject_New(_librsync_DeltaMakerObject, &_librsync_DeltaMakerType);
when _PyObject_New() succeeds
'*dm' was allocated at:   dm = PyObject_New(_librsync_DeltaMakerObject, &_librsync_DeltaMakerType);
ob_refcnt is now refs: 1 owned
189   if (dm == NULL) return NULL;
taking False path
190 
191   /* Put signature at sig_ptr and build hash */
192   sig_loader = rs_loadsig_begin(&sig_ptr);
193   buf.next_in = sig_string;
194   buf.avail_in = (size_t)sig_length;
195   buf.next_out = outbuf;
196   buf.avail_out = (size_t)RS_JOB_BLOCKSIZE;
197   buf.eof_in = 1;
198   result = rs_job_iter(sig_loader, &buf);
199   rs_job_free(sig_loader);
200   if (result != RS_DONE) {
when taking True path
201     _librsync_seterror(result, "delta rs_signature_t builder");
202     return NULL;
203   }
204   if ((result = rs_build_hash_table(sig_ptr)) != RS_DONE) {
205     _librsync_seterror(result, "delta rs_build_hash_table");
206     return NULL;
207   }
208 
209   dm->sig_ptr = sig_ptr;
210   dm->delta_job = rs_delta_begin(sig_ptr);
211   return (PyObject*)dm;
212 }

File: duplicity/_librsyncmodule.c
Function: _librsync_new_deltamaker
Error: returning (PyObject*)NULL without setting an exception
170 static PyObject*
171 _librsync_new_deltamaker(PyObject* self, PyObject* args)
172 {
173   _librsync_DeltaMakerObject* dm;
174   char *sig_string, outbuf[RS_JOB_BLOCKSIZE];
175   Py_ssize_t sig_length;
176   rs_job_t *sig_loader;
177   rs_signature_t *sig_ptr;
178   rs_buffers_t buf;
179   rs_result result;
180 
181 #if PY_MAJOR_VERSION >= 3
182   if (!PyArg_ParseTuple(args,"y#:new_deltamaker", &sig_string, &sig_length))
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
183 #else
184   if (!PyArg_ParseTuple(args,"s#:new_deltamaker", &sig_string, &sig_length))
185 #endif
186     return NULL;
187 
188   dm = PyObject_New(_librsync_DeltaMakerObject, &_librsync_DeltaMakerType);
when _PyObject_New() succeeds
189   if (dm == NULL) return NULL;
taking False path
190 
191   /* Put signature at sig_ptr and build hash */
192   sig_loader = rs_loadsig_begin(&sig_ptr);
193   buf.next_in = sig_string;
194   buf.avail_in = (size_t)sig_length;
195   buf.next_out = outbuf;
196   buf.avail_out = (size_t)RS_JOB_BLOCKSIZE;
197   buf.eof_in = 1;
198   result = rs_job_iter(sig_loader, &buf);
199   rs_job_free(sig_loader);
200   if (result != RS_DONE) {
when taking True path
201     _librsync_seterror(result, "delta rs_signature_t builder");
202     return NULL;
203   }
204   if ((result = rs_build_hash_table(sig_ptr)) != RS_DONE) {
205     _librsync_seterror(result, "delta rs_build_hash_table");
206     return NULL;
207   }
208 
209   dm->sig_ptr = sig_ptr;
210   dm->delta_job = rs_delta_begin(sig_ptr);
211   return (PyObject*)dm;
212 }