mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
esx: Remove dead store in esxUtil_ParseDatastorePath
The ++ on preliminaryFileName was a left over from a previous version of this function that explicitly returned the filename and did a strdup on preliminaryFileName afterwards. As the filename isn't returned explicitly anymore remove the preliminary variable for it and reuse the tmp variable instead. Reported by Eric Blake, detected by clang.
This commit is contained in:
parent
29e131dec2
commit
d0a8f99c75
@ -3,7 +3,7 @@
|
||||
* esx_util.c: utility functions for the VMware ESX driver
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
|
||||
* Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com>
|
||||
* Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -284,7 +284,6 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
||||
char *saveptr = NULL;
|
||||
char *preliminaryDatastoreName = NULL;
|
||||
char *preliminaryDirectoryAndFileName = NULL;
|
||||
char *preliminaryFileName = NULL;
|
||||
|
||||
if ((datastoreName != NULL && *datastoreName != NULL) ||
|
||||
(directoryName != NULL && *directoryName != NULL) ||
|
||||
@ -328,11 +327,11 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
||||
}
|
||||
|
||||
if (directoryName != NULL) {
|
||||
/* Split <path> into <directory>/<file> */
|
||||
preliminaryFileName = strrchr(preliminaryDirectoryAndFileName, '/');
|
||||
/* Split <path> into <directory>/<file> and remove /<file> */
|
||||
tmp = strrchr(preliminaryDirectoryAndFileName, '/');
|
||||
|
||||
if (preliminaryFileName != NULL) {
|
||||
*preliminaryFileName++ = '\0';
|
||||
if (tmp != NULL) {
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
if (esxVI_String_DeepCopyValue(directoryName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user