mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-29 12:12:12 +00:00
rbd: remove stack allocations
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
9371d3f2b6
commit
3206805085
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "memory_utils.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
#include "storage_utils.h"
|
#include "storage_utils.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@ -195,9 +196,9 @@ int rbd_create(struct lxc_storage *bdev, const char *dest, const char *n,
|
|||||||
|
|
||||||
int rbd_destroy(struct lxc_storage *orig)
|
int rbd_destroy(struct lxc_storage *orig)
|
||||||
{
|
{
|
||||||
|
__do_free char *rbdfullname = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
const char *src;
|
const char *src;
|
||||||
char *rbdfullname;
|
|
||||||
char cmd_output[PATH_MAX];
|
char cmd_output[PATH_MAX];
|
||||||
struct rbd_args args = {0};
|
struct rbd_args args = {0};
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -215,7 +216,7 @@ int rbd_destroy(struct lxc_storage *orig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(src);
|
len = strlen(src);
|
||||||
rbdfullname = alloca(len - 8);
|
rbdfullname = must_realloc(NULL, len - 8);
|
||||||
(void)strlcpy(rbdfullname, &src[9], len - 8);
|
(void)strlcpy(rbdfullname, &src[9], len - 8);
|
||||||
args.rbd_name = rbdfullname;
|
args.rbd_name = rbdfullname;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user