x86-64 compile fixes and cleanups
[asterisk/asterisk.git] / indications.c
index 55e11ff..25b98a0 100755 (executable)
@@ -123,6 +123,8 @@ static int playtones_generator(struct ast_channel *chan, void *data, int len, in
        ps->f.samples = samples;
        ps->f.offset = AST_FRIENDLY_OFFSET;
        ps->f.data = ps->data;
+       ps->f.delivery.tv_sec = 0;
+       ps->f.delivery.tv_usec = 0;
        ast_write(chan, &ps->f);
 
        ps->pos += x;
@@ -227,7 +229,7 @@ static struct tone_zone *current_tonezone;
 
 /* Protect the tone_zones list (highly unlikely that two things would change
  * it at the same time, but still! */
-ast_mutex_t tzlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_EXPORTED(tzlock);
 
 /* Set global indication country */
 int ast_set_indication_country(const char *country)
@@ -321,6 +323,8 @@ static inline void free_zone(struct tone_zone* zone)
                free(zone->tones);
                zone->tones = tmp;
        }
+       if (zone->ringcadance)
+               free((void*)zone->ringcadance);
        free(zone);
 }
 
@@ -395,6 +399,8 @@ int ast_unregister_indication_country(const char *country)
                        if (option_verbose > 2)
                                ast_verbose(VERBOSE_PREFIX_3 "Unregistered indication country '%s'\n",tz->country);
                        free_zone(tz);
+                       if (tone_zones == tz)
+                               tone_zones = tmp;
                        tz = tmp;
                        res = 0;
                }