summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/libmemif/src/main.c28
-rw-r--r--extras/libmemif/src/memif_private.h2
2 files changed, 3 insertions, 27 deletions
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 1eb6929137e..36f1251a158 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -948,13 +948,7 @@ memif_create_socket (memif_socket_handle_t * sock, const char *filename,
}
memset (ms, 0, sizeof (memif_socket_t));
/* set filename */
- ms->filename = lm->alloc (strlen (filename) + sizeof (char));
- if (ms->filename == NULL)
- {
- err = MEMIF_ERR_NOMEM;
- goto error;
- }
- memset (ms->filename, 0, strlen (filename) + sizeof (char));
+ memset (ms->filename, 0, sizeof (ms->filename));
strlcpy ((char *) ms->filename, filename, sizeof (ms->filename));
ms->type = MEMIF_SOCKET_TYPE_NONE;
@@ -977,11 +971,6 @@ memif_create_socket (memif_socket_handle_t * sock, const char *filename,
error:
if (ms != NULL)
{
- if (ms->filename != NULL)
- {
- lm->free (ms->filename);
- ms->filename = NULL;
- }
if (ms->fd > 0)
{
close (ms->fd);
@@ -1032,13 +1021,7 @@ memif_per_thread_create_socket (memif_per_thread_main_handle_t pt_main,
memset (ms, 0, sizeof (memif_socket_t));
ms->lm = lm;
/* set filename */
- ms->filename = lm->alloc (strlen (filename) + sizeof (char));
- if (ms->filename == NULL)
- {
- err = MEMIF_ERR_NOMEM;
- goto error;
- }
- memset (ms->filename, 0, strlen (filename) + sizeof (char));
+ memset (ms->filename, 0, sizeof (ms->filename));
strlcpy ((char *) ms->filename, filename, sizeof (ms->filename));
ms->type = MEMIF_SOCKET_TYPE_NONE;
@@ -1061,11 +1044,6 @@ memif_per_thread_create_socket (memif_per_thread_main_handle_t pt_main,
error:
if (ms != NULL)
{
- if (ms->filename != NULL)
- {
- lm->free (ms->filename);
- ms->filename = NULL;
- }
if (ms->fd > 0)
{
close (ms->fd);
@@ -1796,8 +1774,6 @@ memif_delete_socket (memif_socket_handle_t * sock)
lm->free (ms->interface_list);
ms->interface_list = NULL;
- lm->free (ms->filename);
- ms->filename = NULL;
lm->free (ms);
*sock = ms = NULL;
diff --git a/extras/libmemif/src/memif_private.h b/extras/libmemif/src/memif_private.h
index 59899fd6285..9542936983e 100644
--- a/extras/libmemif/src/memif_private.h
+++ b/extras/libmemif/src/memif_private.h
@@ -193,7 +193,7 @@ typedef struct
int fd;
uint16_t use_count;
memif_socket_type_t type;
- uint8_t *filename;
+ uint8_t filename[108];
/* unique database */
struct libmemif_main *lm;
uint16_t interface_list_len;