X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fccurve.c;h=1555d88d127541f8890964b9c675ad12f7fd9e3c;hp=6dbe0ac1a42cc7270e2a6038e1164dcf1a73005c;hb=c596d1306f5f92f7eab76224d3b049980a14adcb;hpb=5832fe184606766fef23369159306c0a5799aeb0 diff --git a/hacks/ccurve.c b/hacks/ccurve.c index 6dbe0ac1..1555d88d 100644 --- a/hacks/ccurve.c +++ b/hacks/ccurve.c @@ -201,7 +201,7 @@ self_similar_normalized (Display* display, double x = 0.0; double y = 0.0; - replacement = (Position*)(alloca (segment_count * sizeof (Segment))); + replacement = (Position*)(malloc (segment_count * sizeof (Segment))); copy_points (segment_count, points, replacement); assert (fabs ((replacement [segment_count - 1].x) - 1.0) < EPSILON); assert (fabs (replacement [segment_count - 1].y) < EPSILON); @@ -222,6 +222,7 @@ self_similar_normalized (Display* display, x = next_x; y = next_y; } + free((void*)replacement); } } @@ -246,7 +247,7 @@ self_similar (Display* display, { Position* points = (Position*)NULL; - points = (Position*)(alloca (segment_count * sizeof (Position))); + points = (Position*)(malloc (segment_count * sizeof (Position))); normalized_plot (segment_count, segments, points); assert (fabs ((points [segment_count - 1].x) - 1.0) < EPSILON); assert (fabs (points [segment_count - 1].y) < EPSILON); @@ -256,6 +257,7 @@ self_similar (Display* display, maximum_x, maximum_y, minimum_x, minimum_y, segment_count, points); + free((void*)points); } static @@ -723,7 +725,7 @@ screenhack (Display* display, segment_count = lengths [random () % (sizeof (lengths) / sizeof (int))]; segments - = (Segment*)(alloca ((segment_count) * sizeof (Segment))); + = (Segment*)(malloc ((segment_count) * sizeof (Segment))); select_pattern (segment_count, segments); iterations = floor (log (maximum_lines) / log (((double)(segment_count)))); @@ -784,6 +786,7 @@ screenhack (Display* display, if (delay) sleep (delay); screenhack_handle_events (display); } + free((void*)segments); if (pause) sleep (pause); erase_full_window (display, window); }