diff --git a/src/protocolhandler.c b/src/protocolhandler.c index 5d66876..9b06ecd 100644 --- a/src/protocolhandler.c +++ b/src/protocolhandler.c @@ -99,6 +99,7 @@ void _xcb_im_handle_query_extension(xcb_im_t *im, xcb_im_client_t *client, const xcb_im_packet_header_fr_t *hdr, uint8_t *data) { xcb_im_query_extension_fr_t frame; + memset(&frame, 0, sizeof(frame)); _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); @@ -136,6 +137,7 @@ void _xcb_im_handle_encoding_negotiation(xcb_im_t *im, xcb_im_client_t *client, const xcb_im_packet_header_fr_t *hdr, uint8_t *data) { xcb_im_encoding_negotiation_fr_t frame; + memset(&frame, 0, sizeof(frame)); _xcb_im_read_frame_with_error(im, client, frame, data, XIM_MESSAGE_BYTES(hdr)); diff --git a/src/xlibi18n/lcUniConv/8bit_tab_to_h.c b/src/xlibi18n/lcUniConv/8bit_tab_to_h.c index 993979a..1d8a9db 100644 --- a/src/xlibi18n/lcUniConv/8bit_tab_to_h.c +++ b/src/xlibi18n/lcUniConv/8bit_tab_to_h.c @@ -121,10 +121,19 @@ int main (int argc, char *argv[]) { char* fname = malloc(strlen(directory)+strlen(filename)+1); - strcpy(fname,directory); strcat(fname,filename); + if (fname == NULL) { + /* Memory allocation failed, handle the error */ + exit(1); + } + strcpy(fname,directory); + strcat(fname,filename); f = fopen(fname,"w"); - if (f == NULL) + if (f == NULL) { + /* Failed to open file, handle the error */ + free(fname); // Free the allocated memory if fopen fails exit(1); + } + free(fname); // Add this line to free the memory allocated to fname } fprintf(f, "\n");