summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-06-28 09:07:58 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-06-28 14:59:25 +0100
commitcf8dddd5c7913c3b80aa2c28c19afaa8a2757f5e (patch)
tree094f882d14a6a21c039d25c24c58018f909e385b
parentb47b3935669e253de6a83704e6c362b0d71c41dc (diff)
goom: don't allocate 260kB struct on the stack
PluginInfo is quite a sizeable struct, let's not allocate it on the stack, especially not if we're copying it over into another dynamically allocated copy anyway. Fixes #570761.
-rw-r--r--gst/goom/plugin_info.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/gst/goom/plugin_info.c b/gst/goom/plugin_info.c
index 49873843f..aba15ca8f 100644
--- a/gst/goom/plugin_info.c
+++ b/gst/goom/plugin_info.c
@@ -46,6 +46,7 @@
#include "mmx.h"
#endif /* HAVE_MMX */
+#include <string.h>
GST_DEBUG_CATEGORY_EXTERN (goom_debug);
#define GST_CAT_DEFAULT goom_debug
@@ -115,46 +116,45 @@ void
plugin_info_init (PluginInfo * pp, int nbVisuals)
{
- PluginInfo p = { 0, };
int i;
- p.sound.speedvar = p.sound.accelvar = p.sound.totalgoom = 0;
- p.sound.prov_max = 0;
- p.sound.goom_limit = 1;
- p.sound.allTimesMax = 1;
- p.sound.timeSinceLastGoom = 1;
- p.sound.timeSinceLastBigGoom = 1;
- p.sound.cycle = 0;
-
- secure_f_feedback (&p.sound.volume_p, "Sound Volume");
- secure_f_feedback (&p.sound.accel_p, "Sound Acceleration");
- secure_f_feedback (&p.sound.speed_p, "Sound Speed");
- secure_f_feedback (&p.sound.goom_limit_p, "Goom Limit");
- secure_f_feedback (&p.sound.last_goom_p, "Goom Detection");
- secure_f_feedback (&p.sound.last_biggoom_p, "Big Goom Detection");
- secure_f_feedback (&p.sound.goom_power_p, "Goom Power");
-
- secure_i_param (&p.sound.biggoom_speed_limit_p, "Big Goom Speed Limit");
- IVAL (p.sound.biggoom_speed_limit_p) = 10;
- IMIN (p.sound.biggoom_speed_limit_p) = 0;
- IMAX (p.sound.biggoom_speed_limit_p) = 100;
- ISTEP (p.sound.biggoom_speed_limit_p) = 1;
-
- secure_i_param (&p.sound.biggoom_factor_p, "Big Goom Factor");
- IVAL (p.sound.biggoom_factor_p) = 10;
- IMIN (p.sound.biggoom_factor_p) = 0;
- IMAX (p.sound.biggoom_factor_p) = 100;
- ISTEP (p.sound.biggoom_factor_p) = 1;
-
- plugin_parameters (&p.sound.params, "Sound", 11);
-
- p.nbParams = 0;
- p.params = NULL;
- p.nbVisuals = nbVisuals;
- p.visuals = (VisualFX **) malloc (sizeof (VisualFX *) * nbVisuals);
-
- /* huh, we're setting a local variable and now copying it over? */
- *pp = p;
+ memset (pp, 0, sizeof (PluginInfo));
+
+ pp->sound.speedvar = pp->sound.accelvar = pp->sound.totalgoom = 0;
+ pp->sound.prov_max = 0;
+ pp->sound.goom_limit = 1;
+ pp->sound.allTimesMax = 1;
+ pp->sound.timeSinceLastGoom = 1;
+ pp->sound.timeSinceLastBigGoom = 1;
+ pp->sound.cycle = 0;
+
+ secure_f_feedback (&pp->sound.volume_p, "Sound Volume");
+ secure_f_feedback (&pp->sound.accel_p, "Sound Acceleration");
+ secure_f_feedback (&pp->sound.speed_p, "Sound Speed");
+ secure_f_feedback (&pp->sound.goom_limit_p, "Goom Limit");
+ secure_f_feedback (&pp->sound.last_goom_p, "Goom Detection");
+ secure_f_feedback (&pp->sound.last_biggoom_p, "Big Goom Detection");
+ secure_f_feedback (&pp->sound.goom_power_p, "Goom Power");
+
+ secure_i_param (&pp->sound.biggoom_speed_limit_p, "Big Goom Speed Limit");
+ IVAL (pp->sound.biggoom_speed_limit_p) = 10;
+ IMIN (pp->sound.biggoom_speed_limit_p) = 0;
+ IMAX (pp->sound.biggoom_speed_limit_p) = 100;
+ ISTEP (pp->sound.biggoom_speed_limit_p) = 1;
+
+ secure_i_param (&pp->sound.biggoom_factor_p, "Big Goom Factor");
+ IVAL (pp->sound.biggoom_factor_p) = 10;
+ IMIN (pp->sound.biggoom_factor_p) = 0;
+ IMAX (pp->sound.biggoom_factor_p) = 100;
+ ISTEP (pp->sound.biggoom_factor_p) = 1;
+
+ plugin_parameters (&pp->sound.params, "Sound", 11);
+
+ pp->nbParams = 0;
+ pp->params = NULL;
+ pp->nbVisuals = nbVisuals;
+ pp->visuals = (VisualFX **) malloc (sizeof (VisualFX *) * nbVisuals);
+
pp->sound.params.params[0] = &pp->sound.biggoom_speed_limit_p;
pp->sound.params.params[1] = &pp->sound.biggoom_factor_p;
pp->sound.params.params[2] = 0;