Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
memory: fix absence of test after memory allocation
Baptiste Daroussin committed 2 years ago
commit 210e422896f3bd21bb59b12dd10e43d407208af9
parent fbeb91d
2 files changed +5 -1
modified compat/Makefile.autosetup
@@ -8,6 +8,7 @@ SRCS= closefrom.c \
	funopen.c

LOCAL_CFLAGS=	-I$(top_srcdir)/compat \
+
		-I$(top_srcdir)/libpkg \
		-I$(top_srcdir) \
		-I$(top_builddir)

modified compat/funopen.c
@@ -26,8 +26,11 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
+
#include <stdlib.h>

#include "bsd_compat.h"
+
#include "pkg_config.h"
+
#include <xmalloc.h>

#ifndef HAVE_FUNOPEN

@@ -80,7 +83,7 @@ funopen(const void *cookie, int (*readfn)(void *, char *, int),
         int (*writefn)(void *, const char *, int),
         off_t (*seekfn)(void *, off_t, int), int (*closefn)(void *))
{
-
	bsd_cookie_funcs_t *cf = malloc(sizeof(bsd_cookie_funcs_t));
+
	bsd_cookie_funcs_t *cf = xmalloc(sizeof(bsd_cookie_funcs_t));
	cf->readfn  = readfn;
	cf->writefn = writefn;
	cf->seekfn  = seekfn;