Projet

Général

Profil

0011-python-free-internal-string-buffer-if-needed-in-set_.patch

Benjamin Dauvergne, 20 juin 2020 12:44

Télécharger (1,11 ko)

Voir les différences:

Subject: [PATCH 11/21] python: free internal string buffer if needed in
 set_list_of_strings (#44287)

 bindings/python/wrapper_top.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
bindings/python/wrapper_top.c
332 332
		l = PySequence_Length(seq);
333 333
	}
334 334
	for (i=0; i<l; i++) {
335
		const char *astr = NULL;
336

  
335 337
		PyObject *pystr = PySequence_Fast_GET_ITEM(seq, i);
336 338
		if (! PyString_Check(pystr)) {
337 339
			PyErr_SetString(PyExc_TypeError,
338 340
					"value should be a tuple of strings");
339 341
			goto failure;
340 342
		}
341
		list = g_list_append(list, g_strdup(PyString_AsString(pystr)));
343
		astr = PyString_AsString(pystr);
344
		list = g_list_append(list, g_strdup(astr));
345
		PyStringFree(astr);
342 346
	}
343 347
	free_list(a_list, (GFunc)g_free);
344 348
	*a_list = list;
345
-