[Home]

Summary:ASTERISK-24358: chan_vpb.cc does not compile with -Werror using gcc 4.9
Reporter:Jeremy Lainé (sharky)Labels:
Date Opened:2014-09-26 05:54:04Date Closed:2017-12-18 09:35:11.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_vpb
Versions:11.13.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Building asterisk in developer mode with gcc 4.9 fails with the following error:
{noformat}
chan_vpb.cc: In function 'int unload_module()':
chan_vpb.cc:2635:29: error: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
  memset(bridges, 0, sizeof bridges);
                            ^
cc1plus: all warnings being treated as errors
{noformat}
Comments:By: Matt Jordan (mjordan) 2015-01-16 07:18:24.476-0600

Yeah. This is some odd code.

{code}
if (bridges) {
ast_mutex_lock(&bridge_lock);
memset(bridges, 0, sizeof bridges);
ast_mutex_unlock(&bridge_lock);
ast_mutex_destroy(&bridge_lock);
for (int i = 0; i < max_bridges; i++) {
ast_mutex_destroy(&bridges[i].lock);
ast_cond_destroy(&bridges[i].cond);
}
ast_free(bridges);
}
{code}

We're:
# {{memset}}-ing the memory pointed to by {{bridges}} to 0. Since this is technically an array, this will nuke out the first element. Hopefully they didn't have anything in the first element that needed to be reclaimed.
# We *then* index into the array, disposing of the mutexes/condition wait variables. Clearly, we just leaked whatever is on the first array.

I'd like to say I'd fix this, but I have no idea if anyone even uses this anymore. If someone did use this still and I broke them - well, that would kind of suck.

Are you using this channel driver? Are you able to test patches for it? If so, I can try and clean this up - but if not, then I'd recommend simply disabling this channel driver.

By: Joshua C. Colp (jcolp) 2017-12-18 09:35:12.001-0600

The chan_vpb module is currently building fine under latest versions of things.