I was reading the source code of the PyBluez library and noticed that in this block of code memory is allocated with malloc, but never freed:
// add service classes, if any
for(i = 0; i < PySequence_Length(service_classes); i++) {
uuid_t *svc_class_uuid = (uuid_t*) malloc( sizeof( uuid_t ) );
PyObject *item = PySequence_GetItem(service_classes, i);
pyunicode2uuid( item, svc_class_uuid );
svc_class_list = sdp_list_append(svc_class_list, svc_class_uuid);
}
sdp_set_service_classes(&record, svc_class_list);
I assume that this is a memory leak if sdp_list_append() function does not frees the pointer but I could not find any source codes of this function to check.
Should I add free(svc_class_uuid); in the end of this block in my realization?