New upstream version 18.11.1
[deb_dpdk.git] / examples / vhost / main.c
index dc9ea10..2261f08 100644 (file)
@@ -375,11 +375,19 @@ port_init(uint16_t port)
 static int
 us_vhost_parse_socket_path(const char *q_arg)
 {
+       char *old;
+
        /* parse number string */
        if (strnlen(q_arg, PATH_MAX) == PATH_MAX)
                return -1;
 
+       old = socket_files;
        socket_files = realloc(socket_files, PATH_MAX * (nb_sockets + 1));
+       if (socket_files == NULL) {
+               free(old);
+               return -1;
+       }
+
        snprintf(socket_files + nb_sockets * PATH_MAX, PATH_MAX, "%s", q_arg);
        nb_sockets++;
 
@@ -1220,7 +1228,7 @@ destroy_device(int vid)
 
 /*
  * A new device is added to a data core. First the device is added to the main linked list
- * and the allocated to a specific data core.
+ * and then allocated to a specific data core.
  */
 static int
 new_device(int vid)