fix: avoid some memory leaks (#136)
--------- Co-authored-by: leejet <leejet714@gmail.com>
This commit is contained in:
@@ -560,6 +560,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
|
|
||||||
if (results == NULL) {
|
if (results == NULL) {
|
||||||
printf("generate failed\n");
|
printf("generate failed\n");
|
||||||
|
free_sd_ctx(sd_ctx);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,6 +601,8 @@ int main(int argc, const char* argv[]) {
|
|||||||
free(results[i].data);
|
free(results[i].data);
|
||||||
results[i].data = NULL;
|
results[i].data = NULL;
|
||||||
}
|
}
|
||||||
|
free(results);
|
||||||
|
free_sd_ctx(sd_ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~StableDiffusionGGML() {
|
~StableDiffusionGGML() {
|
||||||
|
ggml_backend_free(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_from_file(const std::string& model_path,
|
bool load_from_file(const std::string& model_path,
|
||||||
|
|||||||
Reference in New Issue
Block a user