Skip to content

Commit

Permalink
avoid mem leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Anurag Aggarwal committed Jul 9, 2020
1 parent 1a3e88e commit 5776abf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ui-hlp/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,12 @@ static void uih_batchrender(struct uih_context *c, dialogparam *d)
QString::number(fnames.size()) + ") " + fnames[i];
uih_message(c, hlpmsg.toStdString().c_str());
char* curr_file = strdup(fnames[i].toStdString().c_str());
char* base_name = strdup(d[1].dstring);
strdup(d[1].dstring);
QString file_number = "_" + QString::number(i) + "_";
strcat(base_name, file_number.toStdString().c_str());
char* file_suffix = strdup(file_number.toStdString().c_str());
char* base_name = (char *)malloc(strlen(d[1].dstring) + strlen(file_suffix) + 2);
strcpy(base_name, d[1].dstring);
strcat(base_name, file_suffix);

uih_renderanimation(c, base_name, (xio_path)curr_file, d[2].dint,
d[3].dint, d[4].number, d[5].number,
Expand All @@ -449,6 +452,7 @@ static void uih_batchrender(struct uih_context *c, dialogparam *d)
d[7].dint ? C256 : TRUECOLOR,
#endif
d[8].dint, d[9].dint, c->letterspersec, NULL);
free(base_name);
}
}

Expand Down

0 comments on commit 5776abf

Please sign in to comment.