diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 67ea85a372f56edb870e5b9f2cf4d6b5f67fe7ed..9d12259b5a03964647bf030d356c07fe14ff40c6 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -2357,10 +2357,11 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos) canvas_updatewindowlist(); } else { // T_MESSAGE, T_TEXT, T_ATOM - if (x->te_type == T_TEXT) + if (buf && x->te_type == T_TEXT) { - char * c; - for(c = buf; *c != '\0'; c++) + char *c; + int n; + for(c = buf, n = 0; n < bufsize; n++, c++) { if(*c == '\n') { @@ -2372,7 +2373,7 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos) t_binbuf *b = binbuf_new(); binbuf_text(b, buf, bufsize); binbuf_gettext(b, &c2, &i2); - if (strcmp(c1, c2)) + if (!c1 || strcmp(c1, c2)) { canvas_undo_add(glist_getcanvas(glist), 10, "typing", (void *)canvas_undo_set_recreate(glist_getcanvas(glist), diff --git a/pd/src/m_memory.c b/pd/src/m_memory.c index 39d77babc4e1ff44b82051a49bee923f0a575031..2b2530017428f305feb92119d487275b272ff0dc 100644 --- a/pd/src/m_memory.c +++ b/pd/src/m_memory.c @@ -55,7 +55,7 @@ void *resizebytes(void *old, size_t oldsize, size_t newsize) void *ret; if (newsize < 1) newsize = 1; if (oldsize < 1) oldsize = 1; - ret = (void *)realloc((char *)old, newsize); + ret = (void *)realloc((char *)old, newsize * sizeof(char *)); if (newsize > oldsize && ret) memset(((char *)ret) + oldsize, 0, newsize - oldsize); #ifdef LOUD diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c index 7366c0eff466de11e2d92a56415a1ba3c48d27f5..88dc9b74c2a5ec1f4edd73c383db28d992810d08 100644 --- a/pd/src/s_audio_alsa.c +++ b/pd/src/s_audio_alsa.c @@ -847,14 +847,14 @@ void alsa_getdevs(char *indevlist, int *nindevs, /* apparently, "cardno" is just a counter; but check that here */ if (ndev != cardno) fprintf(stderr, "oops: ALSA cards not reported in order?\n"); - sprintf(devname, "hw:%d", cardno ); - /* fprintf(stderr, "\ntry %s...\n", devname); */ + sprintf(devname, "hw:%d", cardno); + // fprintf(stderr, "\ntry %s...\n", devname); if (snd_ctl_open(&ctl, devname, 0) >= 0) { snd_ctl_card_info_malloc(&info); snd_ctl_card_info(ctl, info); desc = snd_ctl_card_info_get_name(info); - snd_ctl_card_info_free(info); + //snd_ctl_card_info_free(info); } else {