Skip to content

Commit

Permalink
curl_mapper: fix memory leak when initialisation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottox committed Aug 23, 2023
1 parent 3c33781 commit e7f362d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/mapper/curl_mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@

#define _DEFAULT_SOURCE

#include "../../include/sqsh_mapper_private.h"
#ifdef CONFIG_CURL

#include "../../include/sqsh_data_private.h"
#include "../../include/sqsh_error.h"
#include "../utils/utils.h"
# include "../../include/sqsh_mapper_private.h"

#ifdef CONFIG_CURL
# include "../../include/sqsh_data_private.h"
# include "../../include/sqsh_error.h"
# include "../utils/utils.h"

# include <curl/curl.h>
# include <inttypes.h>
Expand Down Expand Up @@ -279,6 +279,7 @@ sqsh_mapper_curl_map(struct SqshMapSlice *mapping) {
static int
sqsh_mapper_curl_cleanup(struct SqshMapper *mapper) {
free(mapper->data.cl.url);
free(mapper->data.cl.header_cache);
sqsh__mutex_destroy(&mapper->data.cl.lock);
curl_easy_cleanup(mapper->data.cl.handle);
return 0;
Expand Down

0 comments on commit e7f362d

Please sign in to comment.