Fixed two potential memory leaks

This commit is contained in:
ritt 2020-04-16 11:01:58 +02:00
parent f1046d45e7
commit c76272a5af

View File

@ -17643,9 +17643,9 @@ void display_line(LOGBOOK *lbs, int message_id, int number, char *mode, int expa
/* check attributes for row style */ /* check attributes for row style */
for (i = 0; i < n_attr; i++) { for (i = 0; i < n_attr; i++) {
if (attrib[i][0] == 0) if (attrib[i][0] == 0)
sprintf(str, "Style %s \"\"", attr_list[i]); snprintf(str, sizeof(str), "Style %s \"\"", attr_list[i]);
else else
sprintf(str, "Style %s %s", attr_list[i], attrib[i]); snprintf(str, sizeof(str), "Style %s %s", attr_list[i], attrib[i]);
if (getcfg(lbs->name, str, display, sizeof(display))) { if (getcfg(lbs->name, str, display, sizeof(display))) {
sprintf(str, "%s\" style=\"%s", rowstyle, display); sprintf(str, "%s\" style=\"%s", rowstyle, display);
strlcpy(rowstyle, str, sizeof(rowstyle)); strlcpy(rowstyle, str, sizeof(rowstyle));
@ -17879,7 +17879,7 @@ void display_line(LOGBOOK *lbs, int message_id, int number, char *mode, int expa
/* check attributes for cell style */ /* check attributes for cell style */
strlcpy(tdstyle, rowstyle, sizeof(tdstyle)); strlcpy(tdstyle, rowstyle, sizeof(tdstyle));
sprintf(str, "Cell Style %s %s", attr_list[i], attrib[i]); snprintf(str, sizeof(str), "Cell Style %s %s", attr_list[i], attrib[i]);
if (getcfg(lbs->name, str, display, sizeof(display))) { if (getcfg(lbs->name, str, display, sizeof(display))) {
sprintf(str, "%s\" style=\"%s", rowstyle, display); sprintf(str, "%s\" style=\"%s", rowstyle, display);
strlcpy(tdstyle, str, sizeof(rowstyle)); strlcpy(tdstyle, str, sizeof(rowstyle));