ret = phypExec(session, cmd, &exit_status, conn);
- if (ret == NULL)
+ if (exit_status < 0 || ret == NULL)
goto err;
char *char_ptr = strchr(ret, '\n');
if (char_ptr)
*char_ptr = '\0';
- if (exit_status < 0 || ret == NULL)
- goto err;
-
VIR_FREE(cmd);
return ret;
ret = phypExec(session, cmd, &exit_status, conn);
- if (ret == NULL)
+ if (exit_status < 0 || ret == NULL)
goto err;
- char *mem_char_ptr = strchr(ret, '\n');
-
- if (mem_char_ptr)
- *mem_char_ptr = '\0';
+ char_ptr = strchr(ret, '\n');
- if (exit_status < 0)
- goto err;
+ if (char_ptr)
+ *char_ptr = '\0';
if (virStrToLong_i(ret, &char_ptr, 10, &memory) == -1)
goto err;
LIBSSH2_SESSION *session = connection_data->session;
char *cmd = NULL;
char *ret = NULL;
+ char *char_ptr;
int exit_status = 0;
int vcpus = 0;
}
ret = phypExec(session, cmd, &exit_status, conn);
- if (ret == NULL)
+ if (exit_status < 0 || ret == NULL)
goto err;
- char *char_ptr = strchr(ret, '\n');
+ char_ptr = strchr(ret, '\n');
if (char_ptr)
*char_ptr = '\0';
if (virStrToLong_i(ret, &char_ptr, 10, &vcpus) == -1)
goto err;
- if (exit_status < 0)
- goto err;
-
VIR_FREE(cmd);
VIR_FREE(ret);
return (unsigned long) vcpus;
}
ret = phypExec(session, cmd, &exit_status, conn);
- if (ret == NULL)
+ if (exit_status < 0 || ret == NULL)
goto err;
- char *char_ptr2 = strchr(ret, '\n');
-
- if (char_ptr2)
- *char_ptr2 = '\0';
+ char_ptr = strchr(ret, '\n');
- if (exit_status < 0)
- goto err;
+ if (char_ptr)
+ *char_ptr = '\0';
if (virStrToLong_i(ret, &char_ptr, 10, &remote_slot) == -1)
goto err;