mpd_client: fix allocation of outputs
authorKurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Fri, 1 May 2015 21:33:07 +0000 (23:33 +0200)
committerKurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Fri, 1 May 2015 21:33:07 +0000 (23:33 +0200)
src/mpd_client.c

index c276bee..39e1f5d 100644 (file)
@@ -455,7 +455,7 @@ int mpd_put_outputs(char *buffer)
         idx = mpd_output_get_id(out);
         if (idx >= soutputs) {
             /* realloc some more */
-            soutputs = (idx + 15) & ~15; /* round up to 16 */
+            soutputs = (idx + 1 + 15) & ~15; /* round up to 16 */
             outputs = realloc(outputs, sizeof(*outputs)*soutputs);
             if (!outputs)
                 exit(1);