Skip to content

Commit

Permalink
rbd: remove stack allocations
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 6, 2019
1 parent 9371d3f commit 3206805
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lxc/storage/rbd.c
Expand Up @@ -33,6 +33,7 @@

#include "config.h"
#include "log.h"
#include "memory_utils.h"
#include "storage.h"
#include "storage_utils.h"
#include "utils.h"
Expand Down Expand Up @@ -195,9 +196,9 @@ int rbd_create(struct lxc_storage *bdev, const char *dest, const char *n,

int rbd_destroy(struct lxc_storage *orig)
{
__do_free char *rbdfullname = NULL;
int ret;
const char *src;
char *rbdfullname;
char cmd_output[PATH_MAX];
struct rbd_args args = {0};
size_t len;
Expand All @@ -215,7 +216,7 @@ int rbd_destroy(struct lxc_storage *orig)
}

len = strlen(src);
rbdfullname = alloca(len - 8);
rbdfullname = must_realloc(NULL, len - 8);
(void)strlcpy(rbdfullname, &src[9], len - 8);
args.rbd_name = rbdfullname;

Expand Down

0 comments on commit 3206805

Please sign in to comment.