Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
malloc: check malloc return
Baptiste Daroussin committed 1 year ago
commit b95e1bc7927af8fbee61e62628807c5acb54f0be
parent f0664ac
2 files changed +4 -2
modified src/clean.c
@@ -58,6 +58,7 @@

#include "pkgcli.h"
#include "pkghash.h"
+
#include "xmalloc.h"

typedef tll(char *) dl_list;

@@ -78,7 +79,7 @@ add_to_dellist(int fd, dl_list *dl, const char *cachedir, const char *path)

	assert(path != NULL);

-
	store_path = strdup(path);
+
	store_path = xstrdup(path);

	if (!quiet) {
		if (first_entry) {
modified src/event.c
@@ -60,6 +60,7 @@

#include "pkg.h"
#include "pkgcli.h"
+
#include "xmalloc.h"

#define STALL_TIME 5

@@ -683,7 +684,7 @@ event_callback(void *data, struct pkg_event *ev)
			signal(SIGINT, cleanup_handler);
			signal_handler_installed = true;
		}
-
		evtmp = malloc(sizeof(struct cleanup));
+
		evtmp = xmalloc(sizeof(struct cleanup));
		evtmp->cb = ev->e_cleanup_callback.cleanup_cb;
		evtmp->data = ev->e_cleanup_callback.data;
		tll_push_back(cleanup_list, evtmp);