rarch_task_push_dbscan - prevent possible memleaks
This commit is contained in:
parent
a187382ecf
commit
ae2f6f06a0
|
@ -558,6 +558,10 @@ bool rarch_task_push_dbscan(const char *fullpath, bool directory, rarch_task_cal
|
||||||
{
|
{
|
||||||
rarch_task_t *t = (rarch_task_t*)calloc(1, sizeof(*t));
|
rarch_task_t *t = (rarch_task_t*)calloc(1, sizeof(*t));
|
||||||
db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t));
|
db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t));
|
||||||
|
|
||||||
|
if (!t || !db)
|
||||||
|
goto error;
|
||||||
|
|
||||||
t->handler = rarch_dbscan_task_handler;
|
t->handler = rarch_dbscan_task_handler;
|
||||||
t->state = db;
|
t->state = db;
|
||||||
t->callback = cb;
|
t->callback = cb;
|
||||||
|
@ -573,6 +577,13 @@ bool rarch_task_push_dbscan(const char *fullpath, bool directory, rarch_task_cal
|
||||||
rarch_task_push(t);
|
rarch_task_push(t);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (t)
|
||||||
|
free(t);
|
||||||
|
if (db)
|
||||||
|
free(db);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue