[asterisk-bugs] [JIRA] (ASTERISK-24358) chan_vpb.cc does not compile with -Werror using gcc 4.9
Matt Jordan (JIRA)
noreply at issues.asterisk.org
Fri Jan 16 07:19:34 CST 2015
[ https://issues.asterisk.org/jira/browse/ASTERISK-24358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=224523#comment-224523 ]
Matt Jordan commented on ASTERISK-24358:
----------------------------------------
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.
> chan_vpb.cc does not compile with -Werror using gcc 4.9
> -------------------------------------------------------
>
> Key: ASTERISK-24358
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-24358
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Channels/chan_vpb
> Affects Versions: 11.13.0
> Reporter: Jeremy Lainé
>
> 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}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list