Avoid freeing a non-malloced entry

This commit is contained in:
Holger Vogt 2026-07-18 17:01:39 +02:00
parent 7caaa1f68b
commit 6d2335d1f7
1 changed files with 4 additions and 2 deletions

View File

@ -383,7 +383,8 @@ cp_usrset(struct variable *var, bool isset)
return (US_DONTRECORD);
} else if (eq(var->va_name, "curplotname")) {
if (plot_cur && (var->va_type == CP_STRING)) {
FREE(plot_cur->pl_name);
if (!eq(plot_cur->pl_name, "constants")) /* not malloced! */
FREE(plot_cur->pl_name);
plot_cur->pl_name = copy(var->va_string);
}
else
@ -391,7 +392,8 @@ cp_usrset(struct variable *var, bool isset)
return (US_DONTRECORD);
} else if (eq(var->va_name, "curplottitle")) {
if (plot_cur && (var->va_type == CP_STRING)) {
FREE(plot_cur->pl_title);
if (!eq(plot_cur->pl_title, "Constant values")) /* not malloced! */
FREE(plot_cur->pl_title);
plot_cur->pl_title = copy(var->va_string);
}
else