Skip to content

Commit d8c7978

Browse files
author
sfeam
committed
memory leak
1 parent d5e8186 commit d8c7978

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
reopened. So we fix the ordering of code in cairotrm_init that
88
frees the old plot.cr before reinitializing a new one.
99

10+
* src/parse.c (parse_array_assignment): Memory leak.
11+
1012
2017-09-18 Ethan A Merritt <[email protected]>
1113

1214
* src/datafile.c (f_columnhead df_set_key_title) src/datafile.h

demo/boxclusters.dem

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# This could, for example, depend on data from other columns in the input.
99
#
1010

11-
set title "Clustered bar graph with individual colors\nspecified vis plotstyle 'boxes'"
11+
set title "Clustered bar graph with individual colors\nspecified via plotstyle 'boxes'"
1212
set title boxed offset 0,-3 font ",15"
1313
set style fill solid border lt -1
1414
set style textbox opaque noborder
@@ -37,4 +37,4 @@ plot for [i=0:3] 'candlesticks.dat' \
3737
using (xcoord(i)):(column(i+2)):(color(i)) with boxes lc palette z
3838

3939
pause -1 "<cr> to continue"
40-
reset
40+
reset

src/parse.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef lint
2-
static char *RCSid() { return RCSid("$Id: parse.c,v 1.117 2017-09-18 22:24:03 sfeam Exp $"); }
2+
static char *RCSid() { return RCSid("$Id: parse.c,v 1.118 2017-09-20 01:40:44 sfeam Exp $"); }
33
#endif
44

55
/* GNUPLOT - parse.c */
@@ -509,6 +509,8 @@ parse_array_assignment_expression()
509509

510510
/* Quick check for the most common false positives */
511511
/* i.e. other constructs that begin with "name[" */
512+
if (equals(c_token,"sum") && equals(c_token+3, "="))
513+
return 0;
512514
if (equals(c_token+3, ":"))
513515
return 0;
514516
if (equals(c_token+3, "]") && !equals(c_token+4, "="))
@@ -528,7 +530,8 @@ parse_array_assignment_expression()
528530
c_token += 2;
529531
parse_expression();
530532

531-
/* If this wasn't really an array element assignment, back out */
533+
/* If this wasn't really an array element assignment, back out. */
534+
/* NB: Depending on what we just parsed, this may leak memory. */
532535
if (!equals(c_token, "]") || !equals(c_token+1, "=")) {
533536
c_token = save_token;
534537
at->a_count = save_action;

0 commit comments

Comments
 (0)