[lxc-devel] [PATCH] lxc-test-concurrent: initialize saveptr before use

Stéphane Graber stgraber at ubuntu.com
Tue Dec 10 14:06:18 UTC 2013


On Tue, Dec 10, 2013 at 07:37:46PM +0800, Qiang Huang wrote:
> Or we'll get this build error:
> ...
> cc1: warnings being treated as errors
> concurrent.c: In function ‘main’:
> concurrent.c:165: error: ‘saveptr’ may be used uninitialized in this
> function
> make[2]: *** [concurrent.o] Error 1
> 
> Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/tests/concurrent.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/tests/concurrent.c b/src/tests/concurrent.c
> index b9749df..7145d99 100644
> --- a/src/tests/concurrent.c
> +++ b/src/tests/concurrent.c
> @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) {
>              quiet = 1;
>              break;
>          case 'm': {
> -            char *mode_tok, *tok, *saveptr;
> +            char *mode_tok, *tok, *saveptr = NULL;
> 
>              modes = NULL;
>              for (i = 0, mode_tok = optarg;
> -- 
> 1.8.3
> 
> 

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131210/550c2813/attachment.pgp>


More information about the lxc-devel mailing list