summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2011-02-25 11:31:41 +0100
committerMichael Schroeder <mls@suse.de>2011-02-25 11:31:41 +0100
commit99ea3b40365e8633a02fd28ebddb5514e4cbdb00 (patch)
tree7cf5b02d1a5085d2f856ec6dd2838cbea3d5e61c /examples
parent4bbfd79685954dd31b31d91d0ce9b721f25a02a1 (diff)
downloadlibsolv-99ea3b40365e8633a02fd28ebddb5514e4cbdb00.tar.gz
libsolv-99ea3b40365e8633a02fd28ebddb5514e4cbdb00.tar.bz2
libsolv-99ea3b40365e8633a02fd28ebddb5514e4cbdb00.zip
- fix some memory leaks
Diffstat (limited to 'examples')
-rw-r--r--examples/solv.i11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/solv.i b/examples/solv.i
index c7ef48c..325b42d 100644
--- a/examples/solv.i
+++ b/examples/solv.i
@@ -386,6 +386,7 @@ typedef struct {
void set_debuglevel(int level) {
pool_setdebuglevel($self, level);
}
+#if defined(SWIGPYTHON)
%{
SWIGINTERN int loadcallback(Pool *pool, Repodata *data, void *d) {
XRepodata *xd = new_XRepodata(data->repo, data - data->repo->repodata);
@@ -412,6 +413,13 @@ typedef struct {
Py_INCREF(callable);
pool_setloadcallback($self, loadcallback, callable);
}
+#endif
+ void free() {
+#if defined(SWIGPYTHON)
+ Pool_set_loadcallback($self, 0);
+#endif
+ pool_free($self);
+ }
Id str2id(const char *str, int create=1) {
return str2id($self, str, create);
}
@@ -470,6 +478,7 @@ typedef struct {
void createwhatprovides() {
pool_createwhatprovides($self);
}
+ %newobject solvables;
Pool_solvable_iterator * const solvables;
%{
SWIGINTERN Pool_solvable_iterator * Pool_solvables_get(Pool *pool) {
@@ -480,6 +489,7 @@ typedef struct {
return s;
}
%}
+ %newobject repos;
Pool_repo_iterator * const repos;
%{
SWIGINTERN Pool_repo_iterator * Pool_repos_get(Pool *pool) {
@@ -705,6 +715,7 @@ typedef struct {
}
~Dataiterator() {
dataiterator_free($self);
+ sat_free($self);
}
Dataiterator *__iter__() {
return $self;