comparison dbutil.c @ 1361:f9f930e1a516 fuzz

add dbmalloc epoch cleanup
author Matt Johnston <matt@ucc.asn.au>
date Sun, 21 May 2017 10:54:11 +0800
parents 6b89eb92f872
children ddfcadca3c4c
comparison
equal deleted inserted replaced
1360:16f45f2df38f 1361:f9f930e1a516
518 /* Linux says EIO can happen */ 518 /* Linux says EIO can happen */
519 dropbear_exit("Error closing fd %d, %s", fd, strerror(errno)); 519 dropbear_exit("Error closing fd %d, %s", fd, strerror(errno));
520 } 520 }
521 } 521 }
522 522
523 void * m_malloc(size_t size) {
524
525 void* ret;
526
527 if (size == 0) {
528 dropbear_exit("m_malloc failed");
529 }
530 ret = calloc(1, size);
531 if (ret == NULL) {
532 dropbear_exit("m_malloc failed");
533 }
534 return ret;
535
536 }
537
538 void * m_strdup(const char * str) {
539 char* ret;
540
541 ret = strdup(str);
542 if (ret == NULL) {
543 dropbear_exit("m_strdup failed");
544 }
545 return ret;
546 }
547
548 void * m_realloc(void* ptr, size_t size) {
549
550 void *ret;
551
552 if (size == 0) {
553 dropbear_exit("m_realloc failed");
554 }
555 ret = realloc(ptr, size);
556 if (ret == NULL) {
557 dropbear_exit("m_realloc failed");
558 }
559 return ret;
560 }
561
562 void setnonblocking(int fd) { 523 void setnonblocking(int fd) {
563 524
564 TRACE(("setnonblocking: %d", fd)) 525 TRACE(("setnonblocking: %d", fd))
565 526
566 if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { 527 if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {